Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
how sort elements in an array in desired fashion

Subject: how sort elements in an array in desired fashion

From: sathish kumar

Date: 20 Dec, 2012 09:10:06

Message: 1 of 3

i have a array of elements A=(1 2 3 4 5 6)
i know ascending mode ,and descending mode by sort(A,mode)
but i want the array in my require fashion i.e,(6 5 3 2 4 1)
how to get above fashion from array A
please tell me how to do it in matlab

Subject: how sort elements in an array in desired fashion

From: Matt J

Date: 20 Dec, 2012 09:37:08

Message: 2 of 3

"sathish kumar" <satty634@gmail.com> wrote in message <kaukle$g5$1@newscl01ah.mathworks.com>...
> i have a array of elements A=(1 2 3 4 5 6)
> i know ascending mode ,and descending mode by sort(A,mode)
> but i want the array in my require fashion i.e,(6 5 3 2 4 1)
> how to get above fashion from array A
> please tell me how to do it in matlab

A([6 5 3 2 4 1])

Subject: how sort elements in an array in desired fashion

From: sathish kumar

Date: 20 Dec, 2012 17:15:09

Message: 3 of 3

"Matt J" wrote in message <kaum84$5j9$1@newscl01ah.mathworks.com>...
> "sathish kumar" <satty634@gmail.com> wrote in message <kaukle$g5$1@newscl01ah.mathworks.com>...
> > i have a array of elements A=(1 2 3 4 5 6)
> > i know ascending mode ,and descending mode by sort(A,mode)
> > but i want the array in my require fashion i.e,(6 5 3 2 4 1)
> > how to get above fashion from array A
> > please tell me how to do it in matlab
>
> A([6 5 3 2 4 1])
than u sir for u response

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us