How to invert the index of a vector in Simulink?

It is a simple question but I've been looking for a solution without luck!
Let's say I have this vector:
v = [1 2 3]
And I want this:
v = [3 2 1]
Is there any block that makes that?
Thanks!

 Accepted Answer

If you have the DSP System Toolbox installed, you can use the Flip block to flip the vector horizontally. If you don't have access to this toolbox, simply use the MATLAB Function block to call fliplr instead.

3 Comments

Or use a Selector block with N:-1:1 index vector.
This doesn't work for me. I get the input replicated identically at the output - it's not being flipped.

Sign in to comment.

More Answers (1)

You can use "Math Function" block and select "Function" as "transpose".
This block is available in base MATLAB.

Categories

Find more on Simulink in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!