Counting the non nan observations in a matrix by row

8 Ansichten (letzte 30 Tage)
joseph Frank
joseph Frank am 22 Aug. 2011
Hi,
I have a matrix for which I want to compute the number of non-nan observations for each row without running a loop. is this possible?

Akzeptierte Antwort

Oleg Komarov
Oleg Komarov am 22 Aug. 2011
sum(~isnan(A),2)

Weitere Antworten (1)

Sean de Wolski
Sean de Wolski am 22 Aug. 2011
sum(A==A,2);
Variant

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by