User`s guide
readmsg
data = readmsg(rx,channelname,datatype,nummsgs) reads the
number of messages defined by
nummsgs. data becomes a cell array of
row matrices,
data = {msg1,msg2,...,msg(nummsgs)},becausesiz
defaults to [1,nummsgs]; each returned message becomes one row
matrix in the cell array.
Each row matrix contains one element for each data value in the current
message
msg# = [element(1), element(2),...,element(l)] where
l is the number of data elements in m essage. In this syntax, the read
messages can have different lengths, unlike the previous syntax options.
data = readmsg(rx,channelname,datatype) reads one data
message, returning a row vector in
data. All of the optional input
arguments—
nummsgs, siz,andtimeout—use their default values.
In all calling syntaxes for
readmsg,youcansetsiz and nummsgs to
empty matrices, causing them to use their default values—
nummsgs =1
and
siz = [1,l], where l is the number of data elements in the read
message.
Caution If the timeout period expires before the output data matrix is
fully populated, you lose all the messages read from the channel to
that point.
Examples cc = ticcs;
rx = cc.rtdx;
open(rx,'ichannel','w');
enable(rx,'ichannel');
open(rx,'ochannel','r');
enable(rx,'ochannel');
indata = 1:25; % Set up some data.
write(cc,0,indata,30);
outdata=read(cc,0,'double',25,10)
outdata =
7-125