Skip to Main Content Skip to Search
Product Documentation

writemsg - Write messages to specified RTDX channel

Syntax

data=writemsg(rx,channelname,data)
data=writemsg(rx,channelname,data,timeout)

IDEs

This function supports the following IDEs:

Description

data = writemsg(rx,channelname,data) writes data to a channel associated with rx. channelname identifies the channel queue, which you must configure for write access beforehand. All messages must be the same type for a single write operation. writemsg takes the elements of matrix data in column-major order.

In data = writemsg(rx,channelname,data,timeout), the optional argument, timeout, limits the time writemsg spends transferring messages from the processor. timeout is the number of seconds allowed to complete the write operation. You can use timeout limit prolonged data transfer operations. If you omit timeout, writemsg applies the global timeout period defined for the IDE handle object IDE_Obj.

writemsg supports the following data types: uint8, int16, int32, single, and double.

Examples

After you load a program to your processor, configure a link in RTDX for write access and use writemsg to write data to the processor. Recall that the program loaded on the processor must define ichannel and the channel must be configured for write access.

IDE_Obj=ticcs;
rx = IDE_Obj.rtdx;
open(rx,'ichannel','w'); % Could use rx.open('ichannel','w')
enable(rx,'ichannel');
inputdata(1:25);
writemsg(rx,'ichannel',int16(inputdata));

As a further illustration, the following code snippet writes the messages in matrix indata to the write-enabled channel specified by ichan. The code in this example processes successfully only when ichan is defined by the program on the processor and enabled for write access.

indata = [1 4 7; 2 5 8; 3 6 9];
writemsg(IDE_Obj.rtdx,'ichan',indata);

The matrix indata is written by column to ichan. The preceding function syntax is equivalent to

writemsg(IDE_Obj.rtdx,'ichan',[1:9]);

See Also

readmat | readmsg | write

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

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