I have a question with regards to the Matlab codes that simulate Simulink models. For instance my system right now comprises a few different subsystems/codes:
- The main script – sets up initial conditions for the simulated Simulink model and also saves and plots some of the outputs (Main code).
- Simulink model that mimics operation of my system.
- Sub script that is a function block in the Simulink model. In this case this block derives some of the values that are used in the model during simulation (Sub code).
Right now I am trying to introduce an additional block into one of my subsystems in Simulink. Just to simplify it is a constant block with the variable named “V”. I am assigning an initial value of V in the sub code. But when I run the Main code that will execute the model (with a constant block V inside), it gives me the error than V is not defined. If I initialise V in the main code it will have the declared value, regardless of any manipulations with V in the Sub code.
Hopefully I described the issue more or less well, because I can’t publish the model here. Thank you in advance.