Is there an easy way to replace NaNs with empty cells when converting a numeric array to a cell array.
6 ビュー (過去 30 日間)
古いコメントを表示
Hello, I have a 1003-by-112 double numeric array that I want to convert to a cell array. My final goal would be to export the cell array to a text file. However, I don't want to have any NaNs in the text-file. I know that a numeric array can't have empty spaces, but a cell array can. So, I am wondering if there is an option to replace the NaNs with empty spaces when using the command "num2cell" to convert the numeric array to a cell array. I could think of using a for loop with a nested if-else loop to do that, but I just want to check if there is an easier way to do that. Thank you in advance for any help.
0 件のコメント
採用された回答
James Tursa
2011 年 6 月 25 日
e.g.,
A = your double array;
C = your cell array;
idx = isnan(A);
C(idx) = {[]};
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Cell Arrays についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!