Simulink/Stateflow: Variable value cannot by changes in model

27 ビュー (過去 30 日間)
Marco
Marco 2024 年 11 月 14 日 8:47
コメント済み: Marco 2024 年 11 月 14 日 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

回答 (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 Center および File ExchangeStateflow についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by