Skip to Main Content Skip to Search
Product Documentation

ssGetDataTypeTotalSlope - Return total slope of scaling of registered data type

Syntax

extern double ssGetDataTypeTotalSlope (SimStruct *S, DTypeId
                                       dataTypeId)

Arguments

S

SimStruct representing an S-function block.

dataTypeId

Data type ID of the registered data type for which you want to know the total slope.

Description

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:

This function errors out when ssGetDataTypeIsFxpFltApiCompat returns FALSE.

Requirement

To use this function, you must include fixedpoint.h and fixedpoint.c. For more information, see Structure of the S-Function.

Languages

C

Examples

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.

TLC Functions

FixPt_DataTypeTotalSlope

See Also

ssGetDataTypeBias, ssGetDataTypeFixedExponent, ssGetDataTypeFracSlope

  


Related Products & Applications

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