Replace empty string with NaN in a cell
95 ビュー (過去 30 日間)
古いコメントを表示
I have a cell called A={ "20" "25" "25" [] "20" [] "25" "25" "25" "30"}
I would like to replace cell A with A={ "20" "25" "25" "NaN" "20" "NaN" "25" "25" "25" "30"}
Any help is highly appreciate, thank you.
0 件のコメント
採用された回答
その他の回答 (1 件)
Awais Saeed
2021 年 8 月 23 日
編集済み: Awais Saeed
2021 年 8 月 23 日
clc;clear;close all;
A={ "20" "25" "25" [] "20" [] "25" "25" "25" "30"}
% get locations of empty cell elements
idx = cellfun('isempty',A);
% replace those empty cells with NaN
A(idx) = {NaN}
参考
カテゴリ
Help Center および File Exchange で NaNs についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!