convert to s-function level 2

2 ビュー (過去 30 日間)
dab483
dab483 2013 年 3 月 19 日
In s-funcion level 1, i have this
function sys=mdlGetTimeOfNextVarHit(t,x,u)
sampleTime = 1; % Example, set the next hit to be one second later.
sys = t + sampleTime;
how do i convert to s-function level 2? thanks
  2 件のコメント
Kaustubha Govind
Kaustubha Govind 2013 年 3 月 19 日
At what flag value is this function called?
dab483
dab483 2013 年 3 月 27 日
- mdlUpdate

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

回答 (1 件)

Kaustubha Govind
Kaustubha Govind 2013 年 3 月 27 日
Please look at the third row on this table. You should simply need to register mdlGetTimeOfNextVarHit as your Update function in the setup method:
block.RegBlockMethod('Update' ,@mdlGetTimeOfNextVarHit);
Also, as a general suggestion, can I recommend that you change the name of mdlGetTimeOfNextVarHit to something more appropriate like 'Update'? C S-functions actually do have a method called mdlGetTimeOfNextVarHit, and it is best to avoid confusion with that.

カテゴリ

Help Center および File ExchangePrepare Model Inputs and Outputs についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by