Products & Services Solutions Academia Support User Community Company

Learn more about Fixed-Point Toolbox   

numerictype Object Properties

Data Type and Scaling Properties

All properties of a numerictype object are writable. However, the numerictype properties of a fi object become read only after the fi object has been created. Any numerictype properties of a fi object that are unspecified at the time of fi object creation are automatically set to their default values. The properties of a numerictype object are:

These properties are described in detail in the Property Reference. To learn how to specify properties for numerictype objects in Fixed-Point Toolbox software, refer to Setting numerictype Object Properties.

Setting numerictype Object Properties

Setting numerictype Properties at Object Creation

You can set properties of numerictype objects at the time of object creation by including properties after the arguments of the numerictype constructor function.

For example, to set the word length to 32 bits and the fraction length to 30 bits,

T = numerictype('WordLength', 32, 'FractionLength', 30)
 
T =
 

          DataTypeMode: Fixed-point: binary point scaling
            Signedness: Signed
            WordLength: 32
        FractionLength: 30

Using Direct Property Referencing with numerictype Objects

You can reference directly into a property for setting or retrieving numerictype object property values using MATLAB structure-like referencing. You do this by using a period to index into a property by name.

For example, to get the word length of T,

T.WordLength

ans =

32

To set the fraction length of T,

T.FractionLength = 31
 
T =
 

          DataTypeMode: Fixed-point: binary point scaling
            Signedness: Signed
            WordLength: 32
        FractionLength: 31

Setting numerictype Properties in the Model Explorer

You can view and change the properties for any numerictype object defined in the MATLAB workspace in the Model Explorer. Open the Model Explorer by selecting View > Model Explorer in any Simulink model, or by typing daexplr at the MATLAB command line.

The figure below shows the Model Explorer when you define the following numerictype objects in the MATLAB workspace:

T = numerictype
 
T =
 

          DataTypeMode: Fixed-point: binary point scaling
            Signedness: Signed
            WordLength: 16
        FractionLength: 15

U = numerictype('DataTypeMode', 'Fixed-point: slope and bias')
 
U =
 

          DataTypeMode: Fixed-point: slope and bias scaling
            Signedness: Signed
            WordLength: 16
                 Slope: 2^-15
                  Bias: 0

Select the Base Workspace node in the Model Hierarchy pane to view the current objects in the Contents pane. When you select a numerictype object in the Contents pane, you can view and change its properties in the Dialog pane.

  


Free Early Verification Kit

Learn how to apply early verification to your development process through these technical resources.

How much time do you spend on testing to ensure implementation meets system-level requirements?

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS