Simulink/Stateflow: Variable value cannot by changes in model

26 次查看(过去 30 天)
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

回答(1 个)

Manikanta Aditya
Manikanta Aditya 2024-11-14,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 个评论
Marco
Marco 2024-11-14,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.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Stateflow 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by