I would like to replace NaN value (in 1 row and 306 columns ) instead of empty matrices inside a cell array of 6804 elements

1 回表示 (過去 30 日間)
I had attached a screen shot of my cell array. I need to replace 1*306 double NaN values instead of empty [] cells. Any help would be appreciated. Thank you so much in advance.
I tried the following code:
c= 6804*1 cell
empties = cellfun('isempty',c);
c(empties) = {NaN};
But it just replace the empty cell with single NaN value

採用された回答

KSSV
KSSV 2018 年 5 月 24 日
編集済み: KSSV 2018 年 5 月 24 日
c = cell(5,1) ;
for i = [1 2 4]
c{i} = rand(1,3) ;
end
empties = cellfun('isempty',c);
c(empties) = {NaN(1,3)} ;

その他の回答 (1 件)

TAB
TAB 2018 年 5 月 24 日
c(empties) = {NaN(1,306)};

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by