필터 지우기
필터 지우기

How to run simulink from matlab script, pause the simulation, change constant values, and continue the simulation

조회 수: 4 (최근 30일)
Hi all, I want to run a simulation from a matlab script (or function) using workspace variables as parameter values for constant blocks in the simulation. I want to be able to pause the simulation at a specific time (say 10 seconds in) and change the value of the constant, then resume the simulation. Is there a way to do this. As a simple descriptive example, lets say I have a simulation which plots A*sin(wt) in a scope. 'A' and 'w' are constant blocks with values which are defined in the workspace with A=1 and w=1. At 1 second into the simulation, I want to pause it and change A=2, then continue the simulation. Is it possible to do this in a matlab script? If so, please let me know how.

답변 (1개)

kintali narendra
kintali narendra 2016년 9월 23일
"sim" is the name of the function which can run the simulation from through programming. check the link below for more details
https://www.mathworks.com/help/simulink/ug/using-the-sim-command.html
  댓글 수: 1
Michael Palmer
Michael Palmer 2016년 9월 24일
Thanks Kintali, I know about the "sim" command; however, I am unsure how to subsequently pause the simulation, change constant values (in the script), and resume. Do you know how this is accomplished?

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by