can we interface simulink with matlab code?

9 ビュー (過去 30 日間)
DhanaLakshmiR
DhanaLakshmiR 2018 年 2 月 26 日
編集済み: DhanaLakshmiR 2018 年 3 月 2 日
Is this possible to interface the simulink model output with matlab code?

回答 (2 件)

Tamir Suliman
Tamir Suliman 2018 年 2 月 26 日
編集済み: Walter Roberson 2018 年 2 月 26 日
you can configure Model Callback Functions to call MATLAB code at specific times in the model lifetime. You can use PostLoadFcn to call something right after a model has been loaded, and InitFcn to call during model update, or right before simulation.
You can run MATLAB-file during simulation (as if it were one of the blocks) using the Interpreted MATLAB Function, but initial conditions are needed at the beginning of simulation, so using the InitFcn callback is a better place to do that.
ref

Walter Roberson
Walter Roberson 2018 年 2 月 26 日
See the To Workspace and To File blocks, and see the sim() command. It is also possible to invoke MATLAB graphics from inside Simulink.
  1 件のコメント
DhanaLakshmiR
DhanaLakshmiR 2018 年 3 月 2 日
編集済み: DhanaLakshmiR 2018 年 3 月 2 日
I have included the below code in my m-file,
x1 = get_param('sixdofinterfacing/xmov','xmov')
here,sixdofinterfacing is the model name,xmov is the subsystem name.Inside th subsytem i have included Tofile block,the input to this block is from my main module.I don't know is this correct or not.It gives the error like this (Error using sampleforinterfacing (line 7) SubSystem block (mask) does not have a parameter named 'xmov'). How to give mask parameters? Any suggestions will be useful.Thanks in advance!

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

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by