[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ordering variables in specific order
From: |
James Sherman Jr. |
Subject: |
Re: ordering variables in specific order |
Date: |
Fri, 21 Mar 2008 17:28:20 -0400 |
let a = [-2, 1, -4, 5, 6], then
[Y,I] = sort(abs(a));
b = a(I);
then b will equal
b = [1, -2, -4, 5, 6];
James
On Fri, Mar 21, 2008 at 5:04 PM, <address@hidden> wrote:
>
>
> Dear friends,
>
> I would like to order the elements of a vector (ascending order) in absolute
> values but I must retain the signs, i.e if we have the vector(-2,1,-4,5,6)
> we must find the following order: 1,-2,-4,5,6.
>
> Can you please help me.
>
> Thank you in advance.
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://www.cae.wisc.edu/mailman/listinfo/help-octave
>
>