how can I update a constant block within a Simulink simulation?

13 visualizaciones (últimos 30 días)
Omar Velazquez
Omar Velazquez el 11 de Nov. de 2016
Respondida: Slava Shougaev el 26 de Ag. de 2020
I have created a Simulink model that takes variables (constants) from the Workspace. Within the Simulink model I have added a Matlab function that recalculates these constants after each iteration. However, after each iteration, instead of considering the newest value calculated for each variable, the model takes again the value I set from the Workspace in the beginning. Any idea on how I can update my values each step?
Thanks, Omar

Respuestas (2)

Slava Shougaev
Slava Shougaev el 26 de Ag. de 2020
You can also use the 'IC' block (Initial Conditions).

Hari Desanur
Hari Desanur el 15 de Nov. de 2016
The variables you are updating might be local to your MATLAB function.
Consider defining the variables in the MATLAB function as persistent or global . This might resolve the issue where the changes being made to the variables are not reset.

Categorías

Más información sobre Simulink Functions en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by