Length of elements in array that are not NaN

조회 수: 54 (최근 30일)
Benjamin
Benjamin 2018년 11월 12일
댓글: Benjamin 2018년 11월 12일
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