Length of elements in array that are not NaN

56 次查看(过去 30 天)
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.

采纳的回答

Matt J
Matt J 2018-11-12
编辑:Matt J 2018-11-12
num_no_nans = sum( ~isnan(thisS(:,11)) )

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by