How can I set the default view when I open a bloc in Simulink

1 次查看(过去 30 天)
Hello,
I recently upgraded to Simulink 2016b. When I open a bloc in Simulink, the view is occasionnaly way off, and I need to press space to fit the view.
I've tried to save the model when the view is fitted, close it and reopen it, with no succes.
Can I set the default view when I open a bloc to be fitted?
Thanks

采纳的回答

BDI
BDI 2023-5-17
编辑:BDI 2023-5-17
The solution I've found (years ago) is to use the model callback PostLoadFcn and to fit the view programmatically every time the model is open with this script :
top = gcb;
while(get_param(top, 'Parent')~=0) %or split
top = get_param(top, 'Parent');
end
all_Subsystem = find_system(top, 'FollowLinks', 'on','BlockType','SubSystem');
for i=1:numel(all_Subsystem)
set_param(all_Subsystem{i},'Zoomfactor','fit to view')
end

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Programmatic Model Editing 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by