How can I automatically autoscale the plots in Simulink's Scope during a simulation?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-10 23:59:19

问题


When I want to look at signals in the scope during a simulation, I might have to click on the Autoscale button whenever the signal is out of view. Is there a way to automatically autoscale so you can always see the whole signal during the simulation?

[Simulink 8.3, Matlab R2014a]


回答1:


you can do that by writing a function to ask Simulink to automatically autoscale and call it every N seconds. The function I got are from here, it just basically triggers the autoscale button :

 % find all scope blocks as MATLAB figures:
set(0, 'showhiddenhandles', 'on')
scope = findobj(0, 'Tag', 'SIMULINK_SIMSCOPE_FIGURE');
for i=1:length(scope)
  % this is the callback of the "autoscale" button:
  simscope('ScopeBar', 'ActionIcon', 'Find', scope(i))
end
set(0, 'showhiddenhandles', 'off')


来源:https://stackoverflow.com/questions/33437444/how-can-i-automatically-autoscale-the-plots-in-simulinks-scope-during-a-simulat

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!