number of non-nan values across each element in n-dimensional matrix
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Vesp
el 7 de Jul. de 2016
Comentada: Vesp
el 7 de Jul. de 2016
Hello all,
I would like to know how to count the number of non-nan values across each element in a 192x144x8766 matrix. Where the dimensions is representative of days (8766 days). I want a final matrix with the number of non-Nan values for each element across all 8766 days.
For example, count of # of non-nan in 1x1x1:8766 so that I can get a fraction of non-nan values over the 8766 days per element (cell in the matrix).
Thank you for any help on this.
2 comentarios
James Tursa
el 7 de Jul. de 2016
Editada: James Tursa
el 7 de Jul. de 2016
You want the number of non-NaN's in each 192x144 slice? So you would end up with a 8766 element vector? Or do you expect to end up with a 192x144 element matrix result?
Respuesta aceptada
James Tursa
el 7 de Jul. de 2016
Is this what you want?
x = your 192x144x8766 array
result = sum(~isnan(x),3);
Más respuestas (1)
Ver también
Categorías
Más información sobre NaNs en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!