Setting the end time in Simulink through an m-file; Online help seems to be wrong and unhelpful

조회 수: 3 (최근 30일)
I am using commands like the following:
set_param('practicesimmodel','StartTime','0','StopTime','20');
sim('practicesimmodel');
However, MATLAB is totally ignoring what I set as the StoptTime and continues using what has been placed in the simulink model window. How do I automate this so I can change the stoptime from within an mfile?
thanks

답변 (1개)

Fangjun Jiang
Fangjun Jiang 2021년 3월 10일
Open the model, run the first line and check the model, you will see the 'StopTime' is changed.
The problem is with the second line. Give it a return variable like out=sim('practicesimmodel') and check the result.
This is really the problem with the Mathworks.
  댓글 수: 2
John Anthony Rossiter
John Anthony Rossiter 2021년 3월 10일
thanks. This seems to work but is totally bizarre and not an obvious debug result. Why doesnt mathworks make this more obvious in the help or fix it?
Anthony
Fangjun Jiang
Fangjun Jiang 2021년 3월 10일
I have no idea. I've raised this before. Any Mathworkers watching???

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Configure and View Diagnostics에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by