MATLAB Answers

0

Code generation requires variable to be fully assigned variable before subscripting it error in Simulink

Asked by Gautami Golani on 8 Jul 2019
Latest activity Commented on by Gautami Golani on 18 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

  10 Comments

Sir, could you explain how i could create the timeseries with the From Workspace block or give any example?
You were talking about running the code at the MATLAB level, before starting the Simulink model. You can create the timeseries at the MATLAB level using timeseries()
Thank you for your help sir.
I was succsesfully able to resolve the error.

Sign in to comment.

1 Answer

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).

  0 Comments

Sign in to comment.