Is there a way to perfectly 'autoscale' the simulink scope axes while simulation is running?

34 ビュー (過去 30 日間)
Muhammad Ahmed
Muhammad Ahmed 2012 年 10 月 3 日
回答済み: Adil Murtaza Zuberi 2017 年 12 月 4 日
I've connected many scopes in my complex simulink block diagram and I want to view the full history of my signals while the simulation is running.
When I press the 'autoscale' button, it zooms around the current value of the signal, doesn't fit the whole signal history. However, when simulation is stopped, the button does the perfect job. I cann't wait for my lengthy simulation to complete before viewing full signal..

回答 (4 件)

Azzi Abdelmalek
Azzi Abdelmalek 2012 年 10 月 4 日
In your scope properties, History : uncheck limit data point
  2 件のコメント
Muhammad Ahmed
Muhammad Ahmed 2012 年 10 月 4 日
I had already done this and it is something related to horizontal time span. I was curious about both horizontal and vertical autoscaling
Azzi Abdelmalek
Azzi Abdelmalek 2012 年 10 月 4 日
編集済み: Azzi Abdelmalek 2012 年 10 月 4 日
  • for horizontal autoscaling just set time range to auto
  • for vertical autoscaling. right click on the axis of your scope and click autoscale

サインインしてコメントする。


Muhammad Ahmed
Muhammad Ahmed 2012 年 10 月 4 日
I have partially solved this problem by right-clicking the scope's plot area and manually specifying the Axes Properties. Obviously, it's not as good as autoscale could have been

Adil Murtaza Zuberi
Adil Murtaza Zuberi 2017 年 11 月 23 日
Autoscaling X or Y axis is not the issue. I think it is easily possible via Scope Properties. It would be interesting to know if someone can scale it via Script. So that dynamically during Simulation, one can scale it based on any variable value.

Adil Murtaza Zuberi
Adil Murtaza Zuberi 2017 年 12 月 4 日
****SOLVED******* Here is my piece of code to scale each axis in Scope individually:
scopes = find_system(gcs,'blocktype','Scope');
shh = get(0,'ShowHiddenHandles');
set(0,'ShowHiddenHandles','On');
for i = 1:length(scopes)
set_param (scopes{i},'open','on');
set(gcf,'PaperPositionMode','auto')
set(gcf,'InvertHardcopy','off')
AxesInScope = findall(gcf,'type','axes');
if strcmp(scopes(i),'Model and specific scope name')
for y=1:length(AxesInScope) % Individually access each Axis of Scope
set(gcf,'CurrentAxes',AxesInScope(y));
if y==1 % Accessing axis y of Scope i
ylim([-10 10]) % Scaling Y-Axis from -10 to 10
% Can also be used as variable of input signal in command ylim
elseif y==2
lim_Left=max(N2_Left);
lim_Right=max(N2_Right); % N2_Left and N2_Right should be some signals in Workspace
lim=max(lim_Left,lim_Right)+5;
ylim([-0.5 lim])
elseif y==3
end
end
else
end

カテゴリ

Help Center および File ExchangeScopes and Data Logging についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by