Can I convert empty strings to NaNs automatically in a cell array?
14 ビュー (過去 30 日間)
古いコメントを表示
In MATLAB, I have a cell array containing nonempty strings, numbers, and empty strings. I want to change the empty strings to NaNs using a MATLAB function.
採用された回答
MathWorks Support Team
2009 年 6 月 27 日
The CELLFUN command provides this functionality:
% Return a boolean array named 'empties' (with same dimensions as cell array
% 'A') with true for each empty element and false otherwise
empties = cellfun('isempty',A);
% Now change all the empty cells in A from empty strings '' to double NaN
A(empties) = {NaN};
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Data Import from MATLAB についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!