I have a variant subsystem where one of the controls is throttle_controller == 1.
My initFcn first clears the workspace, then runs a script where this variable throttle_controller gets initialized. If I run the stuff in the initFcn from the command line, this variable throttle_controller does show up so I know the initFcn works as intended.
When I run the simulation, I get an error
Caused by:
- Undefined function or variable 'throttle_controller'.
Then I check the workspace, it is blank. Apparently the initFcn didn't even run yet. Does the variant subsystem look for its necessary variables before callbacks are run?
How do I initialize the variable in the initFcn? I don't want to put it in postLoadFcn because I change the value of the variable and run the model many times after I load it once.