Thanks, Oleg,
I am checking it!
Regards
Wei.
"Oleg Komarov" <oleg.komarovRemove.this@hotmail.it> wrote in message <ia68nb$9j9$1@fred.mathworks.com>...
> "Wei He" <Eric.he@hotmail.com> wrote in message <ia67t4$j8a$1@fred.mathworks.com>...
> > Hi, frind,
> >
> > I am dealing with a matrix with positive or negative values.
> >
> > here, I need to find the maximum values (Absolute maximum value) in each rows of the matrix A, and comprise a new column vector B. And repeated to do it for many times to comprise a big matrix C, (each colums of C is different B vector.)
> >
> > For instance:
> > A = [ 1, 3, 9, 8;
> > 7, 12, 3, 0;
> > 7, 6, 0, 3 ]
> >
> > so, B = [ 9;
> > 12;
> > 7 ]
> >
> > How to do that? I tried to use:
> > max(abs(A),[],2)
> > but don't know how to deal with the negative sing "  ".
> >
> > Thanks!!
> >
> > Wei.
>
> [trash,I] = max(abs(A),[],2)
> A(sub2ind(size(A),(1:3).',I))
>
> Oleg
