Asked by Gautami Golani
on 8 Jul 2019

Dear all,

I am implementing the forward and inverse kinematics of a 6 dof robot arm. I was able to run the code in MATLAB alone and it worked well but when I tried to do the same in SIMULINK, I get an error to define 'theta' and 'dtheta' (the variables in my program) before subscripting it.

Can anyone help me resolve this error?

Appreciate any advice or help

Regards

Answer by Srivardhan Gadila
on 18 Jul 2019

Hi Gautami,

“Callbacks” in Simulink can be used to initialize any variables required for the model simulation.

You might initialize the variables “theta” and “dtheta” in the model callbacks (In Simulink: View->Property Inspector->Callbacks).

You can refer to https://www.mathworks.com/help/simulink/ug/model-callbacks.html

Sign in to comment.

Opportunities for recent engineering grads.

Apply Today
## 10 Comments

## Walter Roberson (view profile)

## Direct link to this comment

https://de.mathworks.com/matlabcentral/answers/470653-code-generation-requires-variable-to-be-fully-assigned-variable-before-subscripting-it-error-in-simu#comment_722256

## Gautami Golani (view profile)

## Direct link to this comment

https://de.mathworks.com/matlabcentral/answers/470653-code-generation-requires-variable-to-be-fully-assigned-variable-before-subscripting-it-error-in-simu#comment_722258

## Walter Roberson (view profile)

## Direct link to this comment

https://de.mathworks.com/matlabcentral/answers/470653-code-generation-requires-variable-to-be-fully-assigned-variable-before-subscripting-it-error-in-simu#comment_722262

## Gautami Golani (view profile)

## Direct link to this comment

https://de.mathworks.com/matlabcentral/answers/470653-code-generation-requires-variable-to-be-fully-assigned-variable-before-subscripting-it-error-in-simu#comment_722269

## Walter Roberson (view profile)

## Direct link to this comment

https://de.mathworks.com/matlabcentral/answers/470653-code-generation-requires-variable-to-be-fully-assigned-variable-before-subscripting-it-error-in-simu#comment_722537

## Gautami Golani (view profile)

## Direct link to this comment

https://de.mathworks.com/matlabcentral/answers/470653-code-generation-requires-variable-to-be-fully-assigned-variable-before-subscripting-it-error-in-simu#comment_722646

## Walter Roberson (view profile)

## Direct link to this comment

https://de.mathworks.com/matlabcentral/answers/470653-code-generation-requires-variable-to-be-fully-assigned-variable-before-subscripting-it-error-in-simu#comment_722654

## Gautami Golani (view profile)

## Direct link to this comment

https://de.mathworks.com/matlabcentral/answers/470653-code-generation-requires-variable-to-be-fully-assigned-variable-before-subscripting-it-error-in-simu#comment_722663

## Walter Roberson (view profile)

## Direct link to this comment

https://de.mathworks.com/matlabcentral/answers/470653-code-generation-requires-variable-to-be-fully-assigned-variable-before-subscripting-it-error-in-simu#comment_722677

## Gautami Golani (view profile)

## Direct link to this comment

https://de.mathworks.com/matlabcentral/answers/470653-code-generation-requires-variable-to-be-fully-assigned-variable-before-subscripting-it-error-in-simu#comment_725639

Sign in to comment.