How to make NaN data an empty entry
5 ビュー (過去 30 日間)
古いコメントを表示
Opeyemi Kehinde
2021 年 12 月 5 日
コメント済み: Opeyemi Kehinde
2021 年 12 月 10 日
I have a 2160 by 4320 data that has lots of NaN. How do I make matlab ignore the NaNs (i.e making them an empty entry, not zero) and still maintain the same size of the data size
0 件のコメント
採用された回答
Walter Roberson
2021 年 12 月 5 日
A=randi(500,5,5);
A(A<100)=nan
Ac = num2cell(A)
Ac(isnan(A)) = {[]}
Ac is now the same size as A, but the nan entries have been made empty.
0 件のコメント
その他の回答 (1 件)
Matt J
2021 年 12 月 5 日
It depends on the operation. If you are taking the maximum of each data colum, for example, the NaNs are already ignored, e.g.,
A=randi(500,5,5);
A(A<100)=nan
maximum = max(A)
6 件のコメント
Walter Roberson
2021 年 12 月 8 日
Suppose that somehow you were able to create a numeric-like matrix that you could do mathematics with, and yet displayed some elements as blanks/nothing. What mathematical properties should be blank/nothing have? For example should [blank*2,5] have the blank be treated as the empty vector, and empty times 2 is empty, and horzcat([], 5) is the scalar 5 ??
参考
カテゴリ
Help Center および File Exchange で Resizing and Reshaping Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!