Find NaN elements in a matrix
785 ビュー (過去 30 日間)
古いコメントを表示
Hi Guys,
How can I find the exact location of NaN elements in a matrix. I work with really large arrays (size 1500*200).
How can I find which row has a NaN value in a column matrix or vice versa.?
Thanks
N
0 件のコメント
採用された回答
Walter Roberson
2011 年 10 月 12 日
[row, col] = find(isnan(YourMatrix));
6 件のコメント
Ana Paulina García
2020 年 10 月 5 日
for me this actually creates a 1x0 variable named row and another one named col. None of the variables tells me the index :(
その他の回答 (3 件)
Wayne King
2011 年 10 月 12 日
One way:
X = ones(10,4);
X(3,4) = NaN;
indices = find(isnan(X) == 1);
[I,J] = ind2sub(size(X),indices);
0 件のコメント
Elizabeth Drybrugh
2018 年 5 月 3 日
編集済み: Elizabeth Drybrugh
2018 年 5 月 3 日
Do this to get the sum
sum(isnan(x))
For other functions, it depends on what you actually need....
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で NaNs についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!