Length of elements in array that are not NaN

54 visualizaciones (últimos 30 días)
Benjamin
Benjamin el 12 de Nov. de 2018
Comentada: Benjamin el 12 de Nov. de 2018
I am trying to get the length of an array, and exclude NaN values. At the end of the column there are some NaNs. How can I ignore those?
I tried:
length(thisS(:,11))
But this includes the Nans
When I try:
length(thisS(~isnan((:,11)))
I get:
length(thisS(~isnan((:,11)))
Error: Invalid use of operator.

Respuesta aceptada

Matt J
Matt J el 12 de Nov. de 2018
Editada: Matt J el 12 de Nov. de 2018
num_no_nans = sum( ~isnan(thisS(:,11)) )

Más respuestas (0)

Categorías

Más información sobre Creating and Concatenating Matrices 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