How to redirect Simulink diagnostic viewer output to MATLAB command line?
5 次查看(过去 30 天)
显示 更早的评论
I used to use the diary function in conjunction with the disp function quite a bit to do debugging of my code that involved both MATLAB and Simulink models. MATLAB code could also be a part of the Simulink models themselves (block callback functions, S-Functions, etc.) as well as being part of various driver programs. I know that there are other more sophisticated ways of debugging but good-old "printf" is a tried and tested way of debugging in many languages.
Calls to disp in Simulink-related code have been directed to the Simulink diagnostic viewer in recent releases. This has resulted in a disconnection between the MATLAB-only parts of my applications and the Simulink parts. I would like to see all of the calls to disp placed together.
Simply: is there any way to redirect the output of the Simulink Diagnostics Viewer to the MATLAB command line?
Thanks.
1 个评论
Jonathan
2020-7-6
I have the same concern with R2016b. It seems a very basic question on the use of Simulink models. I can't see how there isn't a simple answer such as "yes it's possible, here's how to configure..." or "no that's not possible".
回答(2 个)
Lauri B
2018-1-29
If you run your simulation from the Matlab command line you should also get diagnostic viewer output there:
>> simOut = sim('MyModel');
0 个评论
Sebastian
2016-10-18
Unfortunately I am also on the search for redirecting the diagnostic viewer output to the Matlab Command Window, and have not yet found a solution for it. But you can log the output to a file, using the Diagnostic Viewer's "diary" function. It is as simple as that:
sldiagviewer.diary('my-log-file.txt') % Start logging to file
% Do any model actions here, also manually
set_param(bdroot, 'SimulationCommand', 'Update');
sldiagviewer.diary('off') % Stop logging
The parameters to "sldiagviewer.diary" are the same as its Matlab counterpart.
0 个评论
另请参阅
类别
在 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!