How to flip a Simulink block VERTICALLY?

Moayad Hani Abu Rmilah picture Moayad Hani Abu Rmilah · Dec 10, 2013 · Viewed 12.3k times · Source

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

Answer

thewaywewalk picture thewaywewalk · Dec 10, 2013

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.