How can I use Matlab command line to [open/close/export as *.fig] signal viewer interfaces in Simulink (2021b?)

조회 수: 3 (최근 30일)
In my Simulink model, I have many Floating Scopes within various subsystems. From the Command Line in Matlab, I would like to:
  • Open '/FloatingScope'
  • Scale X & Y Axis Limits
  • Print to Figure
  • Save Figure as *.jpeg
  • Save Figure as *.fig
  • Close Figure
  • Close '/FloatingScope'
Is this possible? I would love achieve this in this manner, otherwise I need to recreate my Floating Scopes entirely with logsout signals, which would be extremely tedious, as there are dozens of Floating Scopes within our model.

답변 (1개)

Nithin
Nithin 2023년 10월 13일
Hi Cory,
I understand that you want to [open/close/export as *.fig] signal viewer interfaces in Simulink using Command Line in MATLAB.
To implement this, kindly refer to the following steps:
1. Open the Floating Scope:
open_system('/FloatingScope')
2. Scale the X and Y-axis limits:
% Define your desired limits
xLimit = [xMin, xMax];
yLimit = [yMin, yMax];
% Set X and Y axis limits
set_param('/FloatingScope/ScopeName', 'XMin', num2str(xLimit(1)));
set_param('/FloatingScope/ScopeName', 'XMax', num2str(xLimit(2)));
set_param('/FloatingScope/ScopeName', 'YMin', num2str(yLimit(1)));
set_param('/FloatingScope/ScopeName', 'YMax', num2str(yLimit(2));
3. Print to a figure:
print('/FloatingScope/ScopeName', '-sFigure', '-dpng', 'output.png');
4. Save as *.jpeg:
saveas(gcf, 'output.jpeg', 'jpeg');
5. Save as *.fig:
saveas(gcf, 'output.fig', 'fig');
6. Close the figure:
close gcf
7. Close the Floating Scope:
close_system('/FloatingScope')
I hope this answer helps you.
Regards,
Nithin Kumar.

카테고리

Help CenterFile Exchange에서 Scopes and Data Logging에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by