Documentation

Signal Specification

Configure input and output ports for S-Functions

S-Function Callback Methods

mdlInitializeSizesSpecify the number of inputs, outputs, states, parameters, and other characteristics of the C MEX S-function
mdlOutputsCompute the signals that this block emits
mdlSetDefaultPortComplexSignalsSet the numeric types (real, complex, or inherited) of ports whose numeric types cannot be determined from block connectivity
mdlSetDefaultPortDataTypesSet the data types of ports whose data types cannot be determined from block connectivity
mdlSetDefaultPortDimensionInfoSet the default dimensions of the signals accepted or emitted by a C MEX S-function's ports
mdlSetInputPortComplexSignalSet the numeric types (real, complex, or inherited) of the signals accepted by an input port
mdlSetInputPortDataTypeSet the data types of the signals accepted by an input port
mdlSetInputPortSampleTimeSet the sample time of an input port that inherits its sample time from the port to which it is connected
mdlSetOutputPortComplexSignalSet the numeric types (real, complex, or inherited) of the signals accepted by an output port
mdlSetOutputPortDataTypeSet the data type of the signals emitted by an output port
mdlSetOutputPortSampleTimeSet the sample time of an output port that inherits its sample time from the port to which it is connected

SimStruct Functions

ssSetNumInputPortsSpecify the number of input ports that a block has
ssSetInputPortComplexSignalSet the numeric type (real or complex) of an input port
ssSetInputPortDataTypeSet the data type of an input port
ssSetInputPortDirectFeedThroughSpecify the direct feedthrough status of a block's ports
ssSetInputPortOffsetTimeSpecify the offset time of an input port
ssSetInputPortRequiredContiguousSpecify that the signal elements entering a port must be contiguous
ssSetInputPortSampleTimeSpecify the sample time of an input port
ssRegisterUnitFromExprRegister unit from unit expression
ssSetInputPortUnitSpecify unit of input port
ssSetNumOutputPortsSpecify the number of output ports that a block has
ssSetOutputPortComplexSignalSet the numeric type (real or complex) of an output port
ssSetOutputPortDataTypeSet the data type of an output port
ssSetOutputPortOffsetTimeSpecify the offset time of an output port
ssSetOutputPortSampleTimeSpecify the sample time of an output port
ssSetOutputPortUnitSpecify unit of output port
ssGetInputPortComplexSignalDetermine whether an input port accepts complex signals.
ssGetInputPortDataTypeGet the data type of an input port
ssGetInputPortDirectFeedThroughDetermine whether a port has direct feedthrough
ssGetInputPortFrameDataDetermine whether a port accepts signal frames
ssGetInputPortOffsetTimeGet the offset time of an input port
ssGetInputPortRequiredContiguousDetermine whether the signal elements entering a port must be contiguous
ssGetInputPortSampleTimeGet the sample time of an input port
ssGetInputPortSampleTimeIndexGet the sample time index of an input port
ssGetInputPortUnitGet unit of input port
ssGetOutputPortComplexSignalGet the numeric type (complex or real) of an output port
ssGetOutputPortDataTypeGet the data type of an output port
ssGetOutputPortFrameDataDetermine whether a port outputs signal frames
ssGetOutputPortOffsetTimeGet the offset time of an output port
ssGetOutputPortSampleTimeGet the sample time of an output port
ssGetOutputPortUnitGet unit of output port
ssAllowSignalsWithMoreThan2DEnable S-function to work with multidimensional signals
ssSetOneBasedIndexInputPortSpecify that an input port expects one-based indices
ssSetOneBasedIndexOutputPortSpecify that an output port emits one-based indices.
ssSetZeroBasedIndexInputPortSpecify that an input port expects zero-based indices
ssSetZeroBasedIndexOutputPortSpecify that an output port emits zero-based indices.

Examples and How To

Input and Output Ports

How to create input and output ports on an S-function block.

Concepts

S-Function Callback Methods

Description of S-function callback methods

S-Function SimStruct Functions

Overview of SimStruct macros and functions.

Was this topic helpful?