while loop simulink running
조회 수: 5 (최근 30일)
이전 댓글 표시
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!
댓글 수: 0
답변 (1개)
Jim Riggs
2018년 5월 11일
for c=1:10
sim('SimulinkModelName')
end
This will run the specified Simulink model 10 times with c=1 to 10.
참고 항목
카테고리
Help Center 및 File Exchange에서 Simulink Environment Customization에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!