"Hidden" variables after running Simulink model with Matlab function

3 views (last 30 days)
I'm working with a Simulink model that uses a Matlab function saved in m-file. The function is called during simulation with the help of the "Interpreted Matlab function" block. I noticed, that after the first simulation, the second simulation has non-default (non-zero/non start-up) initial values for the variables, which are used in the Matlab function. These values correspond to the final values of the first simulation. So somehow the variables are saved somewhere inside of Matlab, but not seen in the Workspace. These variables are local to the m-file function, i.e. no additional statements like persistent or global are used for them. I also found out, that if I execute the clear('functions') command before running the second simulation, the Simulink model uses then the default (zero/start-up) variables. How can I see those "hidden" variables and how can I clear them without using clear('functions') command? This command also clears all breakpoints, what I don't like.

Answers (0)

Categories

Find more on Modeling in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!