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

1 view (last 30 days)
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

Accepted Answer

BDI
BDI on 17 May 2023
Edited: BDI on 17 May 2023
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

More Answers (0)

Categories

Find more on Programmatic Model Editing in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!