How to print messages in Simulink diagnostic viewer when Sim command is used
15 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
sai kishore chintapally
am 6 Sep. 2023
Kommentiert: sai kishore chintapally
am 25 Sep. 2023
I have an s-function block. It prints some messages during Simulation and compilation. I am using mexprintf to print this messages.
When I use 'sim' command, this messages are getting printed in the MATLAB Command window. But I want this messages in the Simulink Diagnostic viewer.
How to achieve this?
0 Kommentare
Antworten (1)
Dhruv
am 21 Sep. 2023
I understand that you want to use the 'sim' command to print messages via an S-Function block. Currently, the messages appear in the MATLAB Command Window, but you'd like them to be in the Simulink Diagnostic Viewer.
The approach to achieve this depends on your specific workflow. Typically, the 'sim' command is used for entirely programmatic workflows where the model isn't even opened, instead just loaded.
If your goal is to programmatically initiate the simulation to mimic clicking the play button in Simulink's GUI and have the messages appear in the Diagnostic Viewer, you can use the following MATLAB command:
>> set_param('<model_name>', 'SimulationCommand', 'start');
Replace <model_name> with the name of your Simulink model. This command will initiate the simulation as if you had run the model from the Simulink GUI, and any messages generated by the S-Function block will be directed to the Simulink Diagnostic Viewer.
Siehe auch
Kategorien
Mehr zu Configure and View Diagnostics finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!