Level-2 MATLAB® S-functions do not support
defining custom data types within the S-function. However, input and output ports can
inherit their data types from a
Simulink.AliasType object. For example, the S-function in the
following model inherits its input data type from the Constant block:
The Constant block's Output data type field contains the value
MyDouble, which is a
defined in the MATLAB workspace with the following line of code:
MyDouble = Simulink.AliasType('double');
The input and output ports of the Level-2 MATLAB S-function
msfcn_inheritdt.m inherit their
data types. When the Simulink® engine performs data type propagation, it assigns the data type
MyDouble to these ports.
RegisterDataTypeFxpBinaryPoint registers a fixed-point
data type with binary point-only scaling
RegisterDataTypeFxpFSlopeFixExpBias registers a
fixed-point data type with [Slope Bias] scaling specified in terms of fractional
slope, fixed exponent, and bias
RegisterDataTypeFxpSlopeBias registers a data type
with [Slope Bias] scaling
If the registered data type is not one of the Simulink built-in data types, you must have a Fixed-Point Designer™ license.
If you have Fixed-Point Designer, inspect the example models and S-functions provided with the software for examples using the macros for defining fixed-point data types.