rows which do not contain zero
Ältere Kommentare anzeigen
Hi all, I have a matrix D = 294x34. I want to output the number of rows which which may contain a number (so I want the the number of rows which are not all zeros).
Thank you.
1 Kommentar
Mate 2u
am 23 Jul. 2012
Akzeptierte Antwort
Weitere Antworten (2)
count=sum(sum(D==0,2)==0)
count will be the number of rows which are not all zeros in matrix D.
row_numbers = find(sum(A,2) ~= 0);
number_of_rows = numel(row_numbers);
Kategorien
Mehr zu Creating and Concatenating Matrices finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!