Programmatically Flip/Rotate Simulink Block
Ältere Kommentare anzeigen
Hi,
I'd like to programmatically rotate/flip a simulink block - arbitrarily. Unfortunately, the 'orientation' property
seems to support specific orientations, only. Thus, no combination of e.g. 'y-mirror' and 90° clockwise rotation
seems to be possible.
Certainly, Simulink supports that via the 'Format' menue but I did not find an accessible block property for this.
Is there a way to access the 'Format/Flip Block' menu of Simulink via Matlab? I did not find a matching property in the slx model, but maybe I overlooked a possibility. Also, I was not able to send key commands to Simulink.
Any suggestions?
Many thanks in advance!
Akzeptierte Antwort
Weitere Antworten (2)
Jean Matthieu
am 24 Jan. 2023
Bearbeitet: Jean Matthieu
am 24 Jan. 2023
0 Stimmen
Hi
set_param(gcb, 'Orientation', 'left')
--> Other keywords are up, right, down
Is that what you're looking for?
1 Kommentar
Timo Dietz
am 24 Jan. 2023
Liam Tanner
am 3 Jul. 2024
Hi,
a solution to this problem would be:
newBlock= add_block([libraryBlock], [modelName], 'MakeNameUnique', 'on', 'Position', pos);
set_param(newBlock, 'Orientation', 'down') % Orientation
set_param(newBlock, 'BlockMirror', 'on') % invert
set_param(newBlock, 'BlockRotation', 90) % rotate
I hope it helps ;)
Kategorien
Mehr zu Programmatic Model Editing finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!