This example shows how to transfer text data by using the UDP communication protocol and shows how to store the incoming messages in a FIFO queue.
The model receives randomly distributed text messages containing textual color description by using the Stream Input block. The model converts the textual color description into corresponding numeric color code. A FIFO queue stores the color codes. The model sequentially displays the received colors at a sample rate that is perceptible to the human eye.
Message generator subsystem simulates a remote device by randomly sending color text messages to the model. These messages provide input data for the example.
To switch to normal mode if needed, on the Simulation tab, select Normal mode.
To start the real-time execution, on the Simulation tab, click Run.
To start the real-time execution in external mode, on the Desktop Real-Time tab, click Run in Real Time. The model builds, connects to Simulink in external mode, and starts.
These commands open the model and suppress warning about board not installed.
w = warning('off', 'sldrt:blkgui:boardnotonlist'); open_system(fullfile(matlabroot,'toolbox','sldrt','sldrtexamples','sldrtex_stringmessage')); warning(w);
close_system(find_system(gcs ,'BlockType', 'Scope'));
clear close all bdclose all