Quantcast
Channel: MATLAB Central Newsreader Recent Posts
Viewing all articles
Browse latest Browse all 19628

Re: finding a column that has X element in each row

$
0
0
On 11/18/2012 10:17 PM, Jinsoo wrote:

>>
> I appreciate Nasser. Your reply helped me a lot. I would like to get the
>result in order of the row. Your result says that there is 2 in
>column 1, 2, and 5 while I would like to get column 2, column 1,
>column 5 in order of row 1, row 2, and row3. Is there any way to do this?
>


--------------------------
[I,J] = find(a==2);
r = sortrows([I J]);
r(:,2)
---------------------

      2
      1
      5

--Nasser

Viewing all articles
Browse latest Browse all 19628

Trending Articles