How to set StopTime programmatically?

My model stop time is set to 5 seconds. I want to change that programmatically.
open_system(test_model, 'loadonly');
set_param(test_model, 'StopTime', '100')
% run simulation
sim('test');
% save modified model
save_system(test_model, 'modified_model')
When I run the simulation, it does not run for 100 seconds.
However, when I open modified_model I see in the GUI that Stop time is set to 100.
Why is the model running for 5 seconds only and GUI shows 100?

Respuestas (1)

Fangjun Jiang
Fangjun Jiang el 13 de Mayo de 2020
Editada: Fangjun Jiang el 13 de Mayo de 2020

0 votos

test_model and 'test' must have been two different models.

Categorías

Más información sobre Simulink en Centro de ayuda y File Exchange.

Productos

Versión

R2020a

Etiquetas

Preguntada:

el 13 de Mayo de 2020

Editada:

el 13 de Mayo de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by