Programmatically Flip/Rotate Simulink Block
Show older comments
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!
Accepted Answer
More Answers (2)
Jean Matthieu
on 24 Jan 2023
Edited: Jean Matthieu
on 24 Jan 2023
0 votes
Hi
set_param(gcb, 'Orientation', 'left')
--> Other keywords are up, right, down
Is that what you're looking for?
1 Comment
Timo Dietz
on 24 Jan 2023
Liam Tanner
on 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 ;)
Categories
Find more on Programmatic Model Editing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!