MATLAB: How to name and display mux signals read on a real-time target scope

label;muxrealscopesignalsimulinktargettimexpc

How can I name and display mux signals read on a real-time target scope?

Best Answer

Mux signals are "Virtual Signals" and their labels cannot be displayed in a target scope. Instead, the key is to use a "Bus Creator" block instead of a "Mux" block.
Assume that you have two signals with different labels (signal labels can be adjusted by right-clicking on the signal, selecting "Properties" and typing the label into the "Signal name" field).
These two signals can be connected to a "Bus Creator" block to create a single bus signal.
When this bus signal is connected to a "Target Scope", the scope will display the individual labels of the two signals.
If you are not explicitly using a "Mux" block, but rather the signal originates from its source as a six-channel mux, then the procedure would be slightly more involved.
1) You would first have to separate the signal using a "Demux" block.
2) Then each individual signal should be passed through a unit gain block (i.e., "Gain" block with a gain value of 1) so that the virtual signals are converted to non-virtual signals.
3) Then the output signals of the gain blocks could be labeled as desired, before feeding them into a "Bus Creator" block.
4) When the bus signal is connected to a "Target Scope", all individual signal labels should be displayed on the scope of the target machine.