Simulink/Stateflow: Variable value cannot by changes in model

25 views (last 30 days)
Marco
Marco on 14 Nov 2024 at 8:47
Commented: Marco on 14 Nov 2024 at 9:35
Hi all,
I am working on a large simulink model consisting of several submodels, where the core logic is controlled by a stateflow chart, using MATLAB 2023B. From one to another day, I cannot change any code oder algorithms concerning the simulation output in the Data Inspector.
Example:
I just add a local variable and change the value from 0 to 5, somewhere in my model. The state is reached, but the variable value is not switched.
I did not changed any configs and did not update some matlab versions.
However, I cannot find any solution since I do not have any ideas how to tackle the problem or find a solution.
Best,
Marco

Answers (1)

Manikanta Aditya
Manikanta Aditya on 14 Nov 2024 at 8:56
Hi Marco,
I understand that you are encountering issue with your Simulink model where the core logic is controlled by a stateflow chart, using MATLAB R2023b.
Try to follow the following steps and see if this helps.
  • Ensure that your Stateflow chart is correctly detecting changes in the variable values. You can use operators like hasChanged, hasChangedFrom, and hasChangedTo to detect changes in data values.
  • If you are using operating points to save and restore the state of your model, ensure that you are correctly modifying the values of local, output, or persistent data.
  • Use the Model Explorer to manually inspect and change the values of variables in your model workspace. This can help you verify if the changes are being applied correctly.
Refer to the following documentation to know more about:
I hope this helps you.
  1 Comment
Marco
Marco on 14 Nov 2024 at 9:35
Hi Manikanta,
Yes, you understood it right and thanks a lot for the tips, I tried all but cannot track any changes of variables I am changing in the code.
If I just add 5 to a variable at some point, it stays at its initial value.

Sign in to comment.

Categories

Find more on Stateflow 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!