From: Ozge Taskan on 11 Jun 2010 10:52 Hi, I have a matrix (n,4) and some rows are all zero and I try to find in which row all numbers are zero like [1 8 9 0; 0 0 0 0; 8 9 7 6; 7 0 8 0; 0 0 0 0 ] I just want to get the answer as ans=[2 5]. I tried to use find function but it cannot give which row. Can it be possible? Thank you very much in advance. Ozge
From: Sadik on 11 Jun 2010 11:27 Assuming your matrix is M, this should work: zeroRows = find(sum(abs(M),2))==0);
From: Frank Chang on 11 Jun 2010 11:31 On Jun 11, 11:27 am, "Sadik " <sadik.h...(a)gmail.com> wrote: > Assuming your matrix is M, this should work: > > zeroRows = find(sum(abs(M),2))==0); my thoughts are exactly along this line. you beat me on this. :)
From: Matt Fig on 11 Jun 2010 11:47
find(~any(M,2)) |