Programmatically Flip/Rotate Simulink Block
Afficher commentaires plus anciens
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!
Réponse acceptée
Plus de réponses (2)
Jean Matthieu
le 24 Jan 2023
Modifié(e) : Jean Matthieu
le 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 commentaire
Timo Dietz
le 24 Jan 2023
Liam Tanner
le 3 Juil 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 ;)
Catégories
En savoir plus sur Programmatic Model Editing dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!