[sys] output.
Show older comments
Hi,
How do we distinguish between different outputs [sys] of the functions in Matlab level 1 s-function? I have sys=u(i); and I want to use it an input in a different function..
Answers (1)
Kaustubha Govind
on 10 Feb 2012
Since Level-1 S-functions have long been deprecated, and only exist for the sake of backward compatibility, there is not a lot of published documentation on them (if you are writing a new S-function, please consider writing it as a Level-2 S-function). However, if you are maintaining an existing level-1 S-function and want to understand what the return value (sys) means for each flag, type this command in MATLAB:
>> help sfuntmpl
There is a bunch of information. In particular, the part that you are asking about is as follows:
What is returned by SFUNC at a given point in time, T, depends on the
value of the FLAG, the current state vector, X, and the current
input vector, U.
FLAG RESULT DESCRIPTION
----- ------ --------------------------------------------
0 [SIZES,X0,STR,TS] Initialization, return system sizes in SYS,
initial state in X0, state ordering strings
in STR, and sample times in TS.
1 DX Return continuous state derivatives in SYS.
2 DS Update discrete states SYS = X(n+1)
3 Y Return outputs in SYS.
4 TNEXT Return next time hit for variable step sample
time in SYS.
5 Reserved for future (root finding).
9 [] Termination, perform any cleanup SYS=[].
Categories
Find more on Simulink Coder in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!