Filter löschen
Filter löschen

convert to s-function level 2

4 Ansichten (letzte 30 Tage)
dab483
dab483 am 19 Mär. 2013
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 Kommentare
Kaustubha Govind
Kaustubha Govind am 19 Mär. 2013
At what flag value is this function called?
dab483
dab483 am 27 Mär. 2013
- mdlUpdate

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Kaustubha Govind
Kaustubha Govind am 27 Mär. 2013
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.

Kategorien

Mehr zu Block and Blockset Authoring finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by