S-function flag calling from other functions

조회 수: 9 (최근 30일)
koko kinder
koko kinder 2012년 2월 3일
Hi,
Is there anyway to call the mdlInitializeSizes() function from any other function in the matlab level 1 S-function. Thanks

답변 (1개)

Kaustubha Govind
Kaustubha Govind 2012년 2월 3일
I guess you could technically call it from any other method in the same S-function, just like you can call a MATLAB sub-function from the main or any other sub-function in a file. However, in case of an S-function, it is recommended that you let the Simulink engine call it at the right time. Is there a reason that you want to do this?
  댓글 수: 2
koko kinder
koko kinder 2012년 2월 3일
Thanks for your answer. I want to do this because I want to go back to the initialization function to set my initial values again after a clear function.
Kaustubha Govind
Kaustubha Govind 2012년 2월 6일
Do you mean that you want to reset your states? This can only be done in the mdlUpdate method AFAIK. Where is your clear function called from? Note that the return value of the flag stage is important - for example, in mdlOutputs, only outputs can be returned and in mdlUpdate, only states can be returned.

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

Community Treasure Hunt

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

Start Hunting!

Translated by