Programmatically Flip/Rotate Simulink Block
Mostrar comentarios más antiguos
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!
Respuesta aceptada
Más respuestas (2)
Jean Matthieu
el 24 de En. de 2023
Editada: Jean Matthieu
el 24 de En. de 2023
0 votos
Hi
set_param(gcb, 'Orientation', 'left')
--> Other keywords are up, right, down
Is that what you're looking for?
1 comentario
Timo Dietz
el 24 de En. de 2023
Liam Tanner
el 3 de Jul. de 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 ;)
Categorías
Más información sobre Programmatic Model Editing en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!