Simulink/Stateflow: Variable value cannot by changes in model
Mostrar comentarios más antiguos
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
Respuestas (1)
Manikanta Aditya
el 14 de Nov. de 2024
0 votos
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:
- hasChanged - Detect change in data since last time step in Stateflow chart - MATLAB - MathWorks India
- Detect Changes in Data and Expression Values - MATLAB & Simulink - MathWorks India
- Save and Restore Operating Points for Stateflow Charts - MATLAB & Simulink - MathWorks India
- Change Model Workspace Data - MATLAB & Simulink - MathWorks India
I hope this helps you.
1 comentario
Marco
el 14 de Nov. de 2024
Categorías
Más información sobre Simulink en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!