set parameter value from mfile

2 ビュー (過去 30 日間)
mado
mado 2012 年 11 月 3 日
how to set values on different periods of time in simulink from m file? during simulation , for example if i use this command set_param('modelname/variable','value',' ');
  1 件のコメント
Walter Roberson
Walter Roberson 2012 年 11 月 5 日

サインインしてコメントする。

回答 (3 件)

Azzi Abdelmalek
Azzi Abdelmalek 2012 年 11 月 3 日
編集済み: Azzi Abdelmalek 2012 年 11 月 4 日
You must stop or pause simultion before seting new parameters

mado
mado 2012 年 11 月 3 日
i think this example in matlab 'Displaying Mechanical State Values During Simulation ' is doing so , but i can't get it

Raju Purohit
Raju Purohit 2012 年 11 月 4 日
There are several ways.
  1. You can pause the simulation at any instant and go to the particular block parameters and change the values and play the simulation again. But you have to tolerate the pain of pausing the simulation at stipulated times and running again each time you have to change parameters. This is the easiest though. This doesn't use m file.
  2. Otherwise if your parameters are to be changed and you know the parameter values and time intervals beforehand, you can code them in Embedded MATLAB Function block. (Don't forget to include "eml.extrinsic('set_param');" in this block).
  3. Or (the best method) you can create a GUI if you are required to change the parameters continuously without pausing the simulation and when you don't know the time and parameter values beforehand. This is more versatile and less painful. You will have to code the GUI m file.

カテゴリ

Help Center および File ExchangeSimulink についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by