Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

vector order inversion in Matlab

Status
Not open for further replies.

claudiocamera

Full Member level 4
Joined
Aug 19, 2005
Messages
224
Helped
27
Reputation
54
Reaction score
6
Trophy points
1,298
Location
Salvador-BA-Brazil
Activity points
4,282
I am working in a code and I need to invert the elements order of a vector, for instance I have the vector [ 1 2 3 4 5] and I need the vector [5 4 3 2 1] I was wondering that probably there is a function specifically for peforming this task ...
 

if x is your vector

len = length(x)
idx = len:-1:1

x = x(idx)

problem solved
 

There many other ways.
It may be simpler to use this:

x=x(end:-1:1);

hope it helped.
 

fliplr([1 2 3 4 5])

Sometimes the only way to find functions like that is to browse these MATLAB Help sections:
Help -> Contents -> MATLAB -> "Functions - By Category"
Help -> Contents -> MATLAB -> "Functions - Alphabetical List"

Be sure to read the "See Also" section at the bottom of the function description.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top