Length of elements in array that are not NaN

50 ビュー (過去 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)) )
  1 件のコメント
Benjamin
Benjamin 2018 年 11 月 12 日
thanks!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by