Borrar filtros
Borrar filtros

while loop simulink running

5 visualizaciones (últimos 30 días)
Michael Simonovski
Michael Simonovski el 11 de Mayo de 2018
Comentada: Michael Simonovski el 11 de Jun. de 2018
Hello,
i have a simulink model and i want to run it in a while loop. For example:
The simulink model itself should run 10 s, after this a value should increment (c=c+1) and it should run again 10 s. This should happen till a certainly value for example for c appear.
Is it possible to make in Simulink?
My aim:
I want to write a script. This script schould call a simulink model in a while loop, till a value appear.
During the run the matlab script should get in live time certainly values from a channel in simulink (not after the simulink run is finish)!
If the value differ from the set value, the simulation should be stopped, the parameter increment and the run should appear again.
If a error appears, which call a pop up window. The simulink model should stop and the parameter should be incremented again. The simulink should run after it and so on.
Is it possible to make such a script?
How it could look like?
Thanks in advance!

Respuestas (1)

Jim Riggs
Jim Riggs el 11 de Mayo de 2018
for c=1:10
sim('SimulinkModelName')
end
This will run the specified Simulink model 10 times with c=1 to 10.

Categorías

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

Community Treasure Hunt

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

Start Hunting!

Translated by