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

1 visualizzazione (ultimi 30 giorni)
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

Risposta accettata

BDI
BDI il 17 Mag 2023
Modificato: BDI il 17 Mag 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

Più risposte (0)

Categorie

Scopri di più su Programmatic Model Editing in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by