How to print messages in Simulink diagnostic viewer when Sim command is used
17 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (1 件)
Dhruv
2023 年 9 月 21 日
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.
参考
カテゴリ
Help Center および File Exchange で Configure and View Diagnostics についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!