Create MATLAB S-Functions - MATLAB & Simulink (original) (raw)
Main Content
Create custom blocks with Level-2 MATLABĀ® S-functions
MATLAB S-function API enables users to use MATLAB language to create custom blocks with the capability of handling multiple input and output ports as well as signals produced by a SimulinkĀ® model, including matrix and frame signals of any data type.
Blocks
Methods
setup | Specify the number of inputs, outputs, states, parameters, and other characteristics of the MATLAB S-function |
---|---|
Outputs | Compute the signals that this MATLAB S-function block emits |
Terminate | Perform any actions required at termination of the simulation |
CheckParameters | Check the validity of a MATLAB S-Function's parameters |
Derivatives | Compute a MATLAB S-Function's derivatives |
Disable | Respond to disabling of an enabled system containing this MATLAB S-Function block |
Enable | Respond to enabling of an enabled system containing this MATLAB S-Function block |
GetOperatingPoint | Return operating point for MATLAB S-function as MATLAB data structure |
InitializeConditions | Initialize the state vectors of this MATLAB S-function |
PostPropagationSetup | Specify the sizes of the work vectors and create the run-time parameters required by this MATLAB S-function |
ProcessParameters | Process the MATLAB S-function's parameters |
Projection | Perturb the solver's solution of a system's states to better satisfy time-invariant solution relationships |
SetAllowConstantSampleTime | Specify sample time behavior and tunability for S-function blocks with port-based sample times |
SetInputPortComplexSignal | Set the numeric types (real, complex, or inherited) of the signals accepted by an input port |
SetInputPortDataType | Set the data types of the signals accepted by an input port |
SetInputPortDimensions | Set the dimensions of the signals accepted by an input port |
SetInputPortDimensionsMode | Propagate the dimensions mode |
SetInputPortSampleTime | Set the sample time of an input port that inherits its sample time from the port to which it is connected |
SetOutputPortComplexSignal | Set the numeric types (real, complex, or inherited) of the signals accepted by an output port |
SetOutputPortDataType | Set the data type of the signals emitted by an output port |
SetOutputPortDimensions | Set the dimensions of the signals accepted by an output port |
SetOutputPortSampleTime | Set the sample time of an output port that inherits its sample time from the port to which it is connected |
SetOperatingPoint | Restore operating point of MATLAB S-function |
SimStatusChange | Respond to a pause or resumption of the simulation of the model that contains this MATLAB S-function |
Start | Initialize the state vectors of this MATLAB S-function |
Update | Update a block's states |
WriteRTW | Generate code generation data for the MATLAB S-function |
Classes
Topics
- Write Level-2 MATLAB S-Functions
Explains how to create MATLAB S-functions based on the current Level-2 MATLAB S-function application programming interface (API). - S-Function Examples
Create various types of S-functions and S-function features.