MATLAB Link for Code Composer Studio Development Tools    
readmat

Read a matrix of values from an RTDX channel

Syntax

Description

data = readmat(rx,channelname,datatype,siz,timeout) reads a matrix of data from an RTDX channel configured for read access. datatype defines the type of data to read, and channelname specifies the queue to read. readmat reads the desired data from the RTDX link specified by rx. Before you try to read from a channel, open and enable the channel for read access. Replace channelname with the string you specified when you opened the desired channel. channelname must identify a channel that you defined in the program loaded on the target processor. You cannot read data from a channel you have not opened and configured for read access. If necessary, use the RTDX tools provided in CCS IDE to determine which channels exist for the loaded program.

data contains a matrix whose dimensions are given by the input argument vector siz, where siz can be a vector of two or more elements. To operate properly, the number of elements in the output matrix data must be an integral number of channel messages.

When you omit the timeout input argument, readmat reads messages from the specified channel until the output matrix is full or the global timeout period specified in rx elapses.

MATLAB supports reading five data types with readmat:

datatype String
Data Format
'double'
Double-precision floating point values. 64 bits.
'int16'
16-bit signed integers
'int32'
32-bit signed integers
'single'
Single-precision floating point values. 32 bits.
'uint8'
Unsigned 8-bit integers

data = readmat(rx,channelname,datatype,siz) reads a matrix of data from an RTDX channel configured for read access. datatype defines the type of data to read, and channelname specifies the queue to read. readmat reads the desired data from the RTDX link specified by rx. Before you try to read from a channel, open and enable the channel for read access. Replace channelname with the string you specified to open and enable the desired channel. You cannot read data from a channel you have not opened and configured for read access. data contains a matrix whose dimensions are given by the input argument vector siz, where siz can be a vector of two or more elements. To operate properly, the number of elements in the output matrix data must be an integral number of channel messages.

When you include the timeout input argument, readmat reads messages from the specified channel until the output matrix is full or the timeout period elapses.

MATLAB supports reading five data types with readmat:

datatype String
Data Format
'double'
Double-precision floating point values, 64 bits.
'int16'
16-bit signed integers.
'int32'
32-bit signed integers.
'single'
Single-precision floating point values. 32 bits.
'uint8'
Unsigned 8-bit integers.

Examples

In this data read and write example, you write data to the target through the CCS IDE. You can then read the data back in two ways--either through read or through readmsg. To duplicate this example you need to have a program loaded on the target. The channels listed in this example, ichannel and ochannel, must be defined in the loaded program. If the current program on the target defines different channels, you can replace the listed channels with your current ones.

Now use RTDX to read the data into a 5-by-5 array called out_array.

See Also
readmsg, writemsg


  read readmsg