mdlOutputs
Compute the signals that this block emits
Required
Yes
Languages
C, C++
Syntax
#define MDL_OUTPUTSvoid mdlOutputs(SimStruct *S, int_T tid)
Arguments
-
S
-
SimStruct representing an S-Function block.
-
tid
-
Task ID.
Description
The Simulink®engine invokes this required method at each simulation time step. The method should compute the S-function's outputs at the current time step and store the results in the S-function's output signal arrays.
Thetid
(task ID) argument specifies the task running when themdlOutputs
routine is invoked. You can use this argument in themdlOutputs
routine of a multirate S-Function block to encapsulate task-specific blocks of code (seeMultirate S-Function Blocks).
Use theUNUSED_ARG
macro if the S-function does not contain task-specific blocks of code to indicate that thetid
input argument is required but not used in the body of the callback. To do this, insert the line
UNUSED_ARG(tid)
在声明后mdlOutputs
.
Note
If you haveSimulink Coder™, when generating code for a noninlined S-function that contains this method, make sure the method is not wrapped in a#if defined(MATLAB_MEX_FILE)
statement. For example:
#if defined(MATLAB_MEX_FILE) static void mdlOutputs(SimStruct *S) { /* Add mdlOutputs code here * } #endif
Thedefine
statement makes themdlOutputs
method available only to a MATLAB®MEX file. If the S-function is not inlined, theSimulink Coderproduct cannot use this method, resulting in link or run-time errors.
Example
For an example of anmdlOutputs
routine that works with multiple input and output ports, seesfun_multiport.c
.
Version History
Introduced before R2006a