MATLAB Link for Code Composer Studio Development Tools    
cast

Change the datatype of an object in MATLAB Link for Code Composer Studio

Syntax

Description

objname2 = cast(objname,datatype) returns objname2, a copy of objname whose represent property is changed to the data type specified by datatype. Input argument datatype can be any supported datatype. After the cast operation, read or write operations apply the appropriate data conversion to implement on the target the datatype specified by the represent property.

The following datatypes work as input arguments to cast:

Datatype String
represent Property Value
'double'
'float'
'single'
'float'
'int32'
'signed'
'int16'
'signed'
'int8'
'signed'
'uint32'
'unsigned'
'uint16'
'binary'
'uint8'
'binary'
'long double'
'float'
'double_c'
'float'
'float'
'float'
'long'
'signed'
'int'
'signed'
'char'
'signed'
'unsigned long'
'signed'
'unsigned int'
'unsigned'
'unsigned char'
'binary'
'Q0.15'
'signed'
'Q0.31'
'unsigned'

Various TI processors restrict the sizes of the datatypes used by objects in MATLAB Link for Code Composer Studio. Shown in the next table, the processor families restrict the valid word sizes for the listed data types.

represent Property Value
C5x Processor Word Size Limits
C6x Processor Word Size Limits
'float'
32, 64 bits
32,64 bits
'signed'
16, 24, 32, 40, 48, 56, 64 bits
8, 16, 24, 32, 40, 48, 56, 64 bits
'unsigned'
16, 24, 32, 40, 48, 56, 64 bits
8, 16, 24, 32, 40, 48, 56, 64 bits
'binary'
16, 24, 32, 40, 48, 56, 64 bits
8, 16, 24, 32, 40, 48, 56, 64 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.

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

objname2 = cast(objname,datatype,size) returns objname2, a copy of objname, with the specified datatype for the represent property, and the size property value set to size.

See Also

convert


  build ccsboardinfo