Use MATLAB S-Functions as Sim Viewing Devices in External Mode
A sim viewing device encapsulates processing and viewing of signals received from the target system in external mode. During simulation in external mode, the target system uploads the appropriate input values to the sim viewing device in the Simulink® model. The sim viewing device then conditions the input signals as needed and renders the signals on the screen. A sim viewing device runs only on the host, generating no code in the target system and, therefore, allowing extra processing of displayed signals without burdening the generated code. You can use your S-function as a sim viewing device in external mode if it satisfies the following conditions.
The S-function has no output ports.
The S-function contains no states.
The generated code does not require the conditioned signals produced by the S-function.
To specify a Level-2 MATLAB® S-function as a sim viewing device, call the run-time object's
SetSimViewingDevice method in the S-function
setup callback method.