convert

Change object represent property from one data type to another

Syntax

convert(objname,datatype)
convert(objname,datatype,size)

Description

convert(objname,datatype) returns objname with the represent property changed to the data type specified by datatype. Input argument datatype can be any supported data type. After you change the data type specified in represent, read or write operations apply the appropriate data conversion to implement on the target the data type specified by the represent property.

The following data types work as input arguments to convert.

datatype Stringrepresent Property Value

'double'

'float'

'single'

'float'

'int32'

'signed'

'int16'

'signed'

'int8'

'signed'

'uint32'

'unsigned'

'uint16'

'unsigned'

'uint8'

'unsigned'

'long double'

'float'

'float'

'float'

'long'

'signed'

'int'

'signed'

'char'

'signed'/'unsigned'

'unsigned long'

'signed'

'unsigned int'

'unsigned'

'unsigned char'

'unsigned'

'Q0.15'

'fract'

'Q0.31'

'fract'

Various Texas Instruments™ processors restrict the sizes of the data types used by objects in Embedded IDE Link™ CC. Shown in the next table, the processor families restrict the valid word sizes for the listed data types.

Word Size Limits for Supported Processors

represent Property ValueTI's C2000™ ProcessorsTI's C54x™ ProcessorsTI's C55x™ ProcessorsTI's C6000™ Processors

'float'

32 bits

32 bits

32 bits

32, 64 bits

'signed'

16, 32 bits

16, 32 bits

16, 32, 40, 64 bits

8, 16, 32, 40, 64 bits

'unsigned'

16, 32 bits

16, 32 bits

16, 32, 40, 64 bits

8, 16, 32, 40, 64 bits

'fract'

16, 32bits

16, 32 bits

16, 32

16, 32 bits

Using the properties of the objects, you change the word size by changing the value of the storageunitspervalue property of the object. Note that you cannot change the bitsperstorageunit property value, which depends on the processor and whether the object represents a memory location or a register.

Pointer objects, both data and numeric, usually use fewer than 32 bits, such as 22 or 23 bits, but are incorporated in 32-bit words.

convert applies to any object that has the represent property. function, ticcs, and rtdx objects do not use the represent property and do not support convert.

convert(objname,datatype,size) returns objname with the specified data type for the represent property, and the size property value set to size.

Using convert with pointer and rpointer Objects

When you convert a pointer object, the results depend on the data type you specify to convert to in the syntax:

Working with pointer objects and register pointer (rpointer) objects is slightly different from using convert with numeric objects.

See Also

cast

  


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