replace [ ] in an array with 0's
古いコメントを表示
talks about replace [] with 0's for one column. But suppose I have a table with many columns and I want to run this operation for multiple colmns. Is there any way simpler than writing another loop?
採用された回答
その他の回答 (2 件)
KSSV
2020 年 7 月 7 日
You can get all the emtpy functions in a cell using cellfun ..
idx = cellfun(@isempty,C) ; % get empty cells in a cell array C
C(idx) = 0 ; % replace with zero
Note that, cellfun also uses loop inside.
1 件のコメント
KSSV
2020 年 7 月 7 日
0 投票
You run on each column of a table..
5 件のコメント
alpedhuez
2020 年 7 月 7 日
dpb
2020 年 7 月 7 日
You can also address table columns numerically using all the other addressing manners, loops, colon, etc., etc., etc., ...
dpb
2020 年 7 月 7 日
Did you try it? I dunno, don't have your table but can only have empty [] in cell array so the table column content must be a cell it would seem...
Again, w/o a sample piece of data to work on it's tough...
alpedhuez
2020 年 7 月 7 日
カテゴリ
ヘルプ センター および File Exchange で Structures についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!