From: Wayne King on
"Rahul Singhal" <rsinghalomatic(a)gmail.com> wrote in message <i0vn5o$sqt$1(a)fred.mathworks.com>...
> Hi All,
> I have a matrix which contains some negative values. I want to get the indices of top 'k' most negative values in matrix.
>
> How can i do that?
>
> Thanks and Regards
> Rahul

Hi Rahul, have you read the documentation for sort?

reset(RandStream.getDefaultStream);
A = randn(10,10);
[B,I] = sort(A(:));
A(I(1:10)) %smallest ten elements I(1:10) are the indices

Is this what you're getting at?

Wayne
From: Rahul Singhal on
Thanks Wayne. Yes, my problem is solved by sort technique u mentioned below.
Thanks once again...
Rahul

"Wayne King" <wmkingty(a)gmail.com> wrote in message <i0voib$1do$1(a)fred.mathworks.com>...
> "Rahul Singhal" <rsinghalomatic(a)gmail.com> wrote in message <i0vn5o$sqt$1(a)fred.mathworks.com>...
> > Hi All,
> > I have a matrix which contains some negative values. I want to get the indices of top 'k' most negative values in matrix.
> >
> > How can i do that?
> >
> > Thanks and Regards
> > Rahul
>
> Hi Rahul, have you read the documentation for sort?
>
> reset(RandStream.getDefaultStream);
> A = randn(10,10);
> [B,I] = sort(A(:));
> A(I(1:10)) %smallest ten elements I(1:10) are the indices
>
> Is this what you're getting at?
>
> Wayne