help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Abs highest(extreme) value in a matrix with +ve & -ve elements


From: Andy Buckle
Subject: Re: Abs highest(extreme) value in a matrix with +ve & -ve elements
Date: Mon, 23 Jan 2012 12:21:23 +0000

On 23 January 2012 11:30, adla.raghu <address@hidden> wrote:
> Hi guys,
>
> A have a 2150*2150 matrix and I want to find the extreme value in each in
> column/row retaining their +ve or  -ve symbol as well.
>
> Eg:   Say if I have -0.9965743234 and +0.7645334441 in a column/row
>
>    when I do:
>      max(Result(:,2));
>      It only gives me the max +ve value. i.e +0.7645334441
>
>      I need a command that gives me -0.9965743234
>
> Also can I get the index values for all these highest values at a go.
>
> Thanks in advance

My first thought.

a=round((rand(3)-0.5)*10)
[val_pos i_pos]=max(a(:,2))
[val_neg i_neg]=max(-a(:,2));
val_neg= -val_neg
i_neg

This will get complicated when you start looping over all rows and
columns. Also you may get unintended things if a row or column is all
posotive or all negative.



-- 
/* andy buckle */


reply via email to

[Prev in Thread] Current Thread [Next in Thread]