| Contents | Index |
extern double ssGetDataTypeTotalSlope (SimStruct *S, DTypeId
dataTypeId)
SimStruct representing an S-function block.
Data type ID of the registered data type for which you want to know the total slope.
Fixed-point numbers can be represented as
real-world value = (slope × integer) + bias,
where the slope can be expressed as
slope = fractional slope × 2exponent.
This function returns the total slope, rather than the fractional slope, of the data type designated by dataTypeId. To get the fractional slope, use ssGetDataTypeFracSlope:
If the registered data type has trivial scaling, including double and single data types, the function returns a total slope of 1.
If the registered data type is ScaledDouble, the function returns the total slope of the nonoverridden data type. Refer to the examples below.
This function errors out when ssGetDataTypeIsFxpFltApiCompat returns FALSE.
To use this function, you must include fixedpoint.h and fixedpoint.c. For more information, see Structure of the S-Function.
C
The data type sfix32_En4 becomes flts32_En4 with data type override. The total slope returned by this function in either case is 0.0625 (2-4).
The data type ufix16_s7p98 becomes fltu16_s7p98 with data type override. The total slope returned by this function in either case is 7.98.
FixPt_DataTypeTotalSlope
ssGetDataTypeBias, ssGetDataTypeFixedExponent, ssGetDataTypeFracSlope

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |