Counting the non nan observations in a matrix by row

27 visualizaciones (últimos 30 días)
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?

Respuesta aceptada

Oleg Komarov
Oleg Komarov el 22 de Ag. de 2011
sum(~isnan(A),2)

Más respuestas (1)

Sean de Wolski
Sean de Wolski el 22 de Ag. de 2011
sum(A==A,2);
Variant

Categorías

Más información sobre Numeric Types en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by