MATLAB Link for Code Composer Studio Development Tools | ![]() ![]() |
Flush data or messages out of one or more specified RTDX channels
Syntax
flush(rx,'channel
'
,num,timeout) flush(rx,'
channel
'
,num) flush(rx,'
channel
'
,[],timeout) flush(rx,'
channel
'
)
Description
flush(rx,channel,num,timeout)
removes num
oldest data messages from the RTDX channel queue specified by channel
in rx
. To determine how long to wait for the function to complete, flush
uses timeout
(in seconds) rather than the global timeout period stored in rx
. flush
applies the timeout processing when it flushes the last message in the channel queue, since the flush function performs a read to advance the read pointer past the last message. Use this calling syntax only when you specify a channel configured for read access.
flush(rx,channel,num)
removes the num oldest messages from the RTDX channel queue in rx
specified by the string channel
. flush
uses the global timeout period stored in rx to determine how long to wait for the process to complete. Compare this to the previous syntax that specifies the timeout period. Use this calling syntax only when you specify a channel configured for read access.
flush(rx,channel,[],timeout)
removes all data messages from the RTDX channel queue specified by channel
in rx
. To determine how long to wait for the function to complete, flush
uses timeout
(in seconds) rather than the global timeout period stored in rx
. flush
applies the timeout processing when it flushes the last message in the channel queue, since flush
performs a read to advance the read pointer past the last message. Use this calling syntax only when you specify a channel configured for read access.
flush(rx,channel)
removes all pending data messages from the RTDX channel queue specified by channel
in rx
. Unlike the preceding syntax options, you use this statement to remove messages for both read-configured and write-configured channels.
If you use flush
with a write-configured RTDX channel, DKTI sends all the messages in the write queue to the target. For read-configured channels, flush
removes one or more messages from the queue depending on the input argument num
you supply and disposes of them.
Examples
To demonstrate flush
, this example writes data to the target over the input channel, then uses flush
to remove a message from the read queue for the output channel.
cc = ccsdsp; rx = cc.rtdx; open(rx,'ichan','w'); enable(rx,'ichan'); open(rx,'ochan','r'); enable(rx,'ochan'); indata = 1:10; writemsg(rx,'ichan',int16(indata)); flush(rx,'ochan',1);
Now flush the remaining messages from the read channel
![]() | execute | get | ![]() |