How to flip a Simulink block VERTICALLY?
Asked Answered
P

4

6

I have been trying to flip a block in Simulink along the vertical but I couldn't figure out how this can be done. For example, when the "sincos" trigonometric function block is inserted, the sin output is up and the cos output is down. I want the cos output to be up and the sin one down for my connection to be nicer.

I tried to rotate 180 deg and then flip it horizontally, but this even did NOT work.

Any suggestion

Portly answered 10/12, 2013 at 7:34 Comment(0)
J
6

Generally you can rotate and flip every block like desired and the ports are rotated accordingly. Some blocks like this little 'add'-bubble requires special syntax like |+- or -|+- though.

In some very rare cases the rotation of the ports is disabled. I don't have your block, but you can check the following:

  • click on the block
  • switch to the Matlab command prompt and type inspect(gcbh)

Have a look at the MaskPortRotate and PortRotationType properties, whether there are set to default If not you can try to change that. But I'm not sure if that's possible for in-built blocks.

Programatically:

h1 = get_param('modelName/BlockName','handle')
h2 = get_param('modelName/BlockName','handle')
inspect(h1)
inspect(h2)

and then you can use set_param to change the properties.

set_param(h1,'PortRotationType',...)
set_param(h2,'MaskPortRotate',...)

But it possibly could not work and I don't have your block to try it out. But thats the way to go, otherwise it is not possible.


A workaround could be to put your block in subsystem and mask it with the parameters of the underlying block. Then the rotation is working.

Javelin answered 10/12, 2013 at 8:18 Comment(4)
What solved it for this particular block is the workaround you provided although it is not good to apply for other blocks (e.g. Try to flip the "Sum" block vertically. This block is circular and the "Sybsystem" block is rectangular. Your method will transfer the "Sum" block to a "Sum of elements" block). I got some info on how to change parameters of Simulink blocks dynamically. ThnxPortly
@RobotAaly The sum block is what I meant with "little 'add'-bubble" - I was not sure how the name was. You need to change the order of the signs, together with the main direction specifier |. This way you can get every direction you want. If you got a solution, please post it as our own answer, so others with the same problem can have a look.Javelin
thank you. I tried it on the sum and that works. I've accepted your answer as a solution. Happy day to you... :)Portly
++| Solved for me for flipping "Sum" vertically.Actinomycete
A
3

You can rotate a block 90 degrees by selecting one of these commands from the Diagram menu:

Rotate & Flip > Clockwise (or Ctrl+R)
Rotate & Flip > Counterclockwise

A rotation command effectively moves a block's ports from its sides to its top and bottom or from its top and bottom to its size, depending on the initial orientation of the block. The final positions of the block ports depend on the block's port rotation type.

This link can further help you Change the Appearance of a Block.

Aubyn answered 10/12, 2013 at 8:28 Comment(1)
Thnx for the reply. I read this article previously and it didn't help with this trigonometric function or the sum block. When I rotate the block 180 deg (clockwise twice), the cos port keeps being at the bottom instead of being at the top.Portly
G
2

I think I had the same problem.

You have to fix the formula.

Double click on the block, and change the list of sign from |++ to ++| Now you will have the sum comes from up and left, and the result in the right.

Gullet answered 8/4, 2014 at 17:1 Comment(0)
I
1

Flip block laterally by right-clicking on the block and going to Rotate & Flip - > Flip Block. Again right-click and navigate to Rotate & Flip - > Clockwise. You'd have to rotate the block clockwise twice to achieve a vertical flip.

Incognizant answered 13/11, 2019 at 20:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.