Writing S-Functions | ![]() ![]() |
Creating Output Ports
To create and configure output ports, the mdlInitializeSizes
method should first specify the number of input ports that the S-function has, using ssSetNumOutputPorts
. Then, for each output port, the method should specify:
ssSetOutputPortDimensionInfo
ssSetOutputPortMatrixDimensions
ssSetOutputPortVectorDimensions
ssSetOutputWidth
If you want the port's dimensions to depend on block connectivity, set the dimensions to DYNAMICALLY_SIZED
. The S-function must then provide mdlSetOutputPortDimensionInfo
and ssSetDefaultPortDimensionInfo
methods to ensure that output port dimensions are set to the correct values in code generation.
ssSetOutputPortDataType
to set the output port's data type. If you want the data type of the port to depend on block connectivity, specify the data type as DYNAMICALLY_TYPED
. In this case, you must provide implementations of the mdlSetOutputPortDataType
and mdlSetDefaultPortDataTypes
methods to enable the data type to be set correctly during signal propagation.
ssSetOutputComplexSignal
to set the output port's numeric type. If you want the numeric type of the port to depend on the numeric type of the port to which it is connected, specify the data type as inherited
. In this case, you must provide implementations of the mdlSetOutputPortComplexSignal
and mdlSetDefaultPortComplexSignal
methods to enable the numeric type to be set correctly during signal propagation.
![]() | Creating Input and Output Ports | Scalar Expansion of Inputs | ![]() |