필터 지우기
필터 지우기

How do I pass simulink start and stop times to simulink from a .m file called by appdesigner created GUI.

조회 수: 35 (최근 30일)
I have a .m file which I am running that launches a simulink model using _
tstart = 0.096;
tend = 0.011;
sim('mySimulinkModel')_
and using simulation model configuration dialog box in simulink to define simulation Start time and simulation Stop time to 'tstart' and 'tend' respecctively.
Can I pass the start and stop times parametrically using something like:
sim('mySimulinkModel','tstart','0.096','tend','0.011')

채택된 답변

David Barry
David Barry 2016년 12월 12일
Yes. StartTime and StopTime are the Model Parameters that you can set from the command line. The full list of model parameters can be found at https://uk.mathworks.com/help/simulink/slref/model-parameters.html
set_param('mymodel','StartTime','5','StopTime','100')

추가 답변 (1개)

Berkin Birol
Berkin Birol 2019년 12월 25일
One additional answer. If you plan to use tstart and tend parametric, then this works:
tstart = "0.096";
tend = "0.011";
sim('mySimulinkModel','StartTime',tstart,'StopTime',tend)

카테고리

Help CenterFile Exchange에서 Modeling에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by