필터 지우기
필터 지우기

Can we call a m-script during model simulation ?:

조회 수: 2 (최근 30일)
Ajay Pherwani
Ajay Pherwani 2014년 2월 11일
댓글: Ajay Pherwani 2014년 6월 17일
I want to run a script , which will update some of my parameters in the workspace. Is it possible to call a m-script during model simulation .
I have heard of call back functions like StartFnc and CloseFcn,
But my concern is, when a block is hit (active) in simulation , Can we can a script at that particular point ?
Is there any matlab block in simulink to call a m-script ?
  댓글 수: 2
Azzi Abdelmalek
Azzi Abdelmalek 2014년 2월 11일
Do you want to change some parameters in your Simulink model during simulation?
Ajay Pherwani
Ajay Pherwani 2014년 6월 17일
Yes

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

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2014년 2월 11일
편집: Azzi Abdelmalek 2014년 2월 11일
You can control your simulink model from a script file
set_param('modelname', 'SimulationCommand', 'start') % To start your simulation
% Then change your parameters in workspace
set_param('modelname', 'SimulationCommand', 'update') % will update your Simulink parameters
You can also change the parameters in your blocks by using set_param. Look at this example
  댓글 수: 1
Ajay Pherwani
Ajay Pherwani 2014년 6월 17일
I have used mask initialization of a sub-system and call m-script that will solve the purpose . But yes it will run only once at simulation start. Thanks for your comment !!

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

추가 답변 (0개)

카테고리

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