To delete the empty fields in the dataset
1 回表示 (過去 30 日間)
古いコメントを表示
Dear all, Could you please help me that I faced the difficulty to do the data set to be tidy up? I want to delete the empty fields in the data set. The data set(53x2 cell array) is below;
[1x18 struct] []
[1x18 struct] []
[1x18 struct] []
[1x18 struct] []
[1x18 struct] []
[1x18 struct] [1x18 struct]
[] []
[1x18 struct] [1x18 struct]
[1x18 struct] []
[1x18 struct] []
[1x18 struct] []
[1x18 struct] []
[1x18 struct] []
[1x18 struct] []
[] []
[1x18 struct] []
[1x18 struct] []
[1x18 struct] []
[1x18 struct] [1x18 struct]
[] []
[1x18 struct] []
[] []
[1x18 struct] []
[] []
[] []
[1x18 struct] []
[1x18 struct] []
[1x18 struct] []
[1x18 struct] []
[1x18 struct] []
[1x18 struct] [1x18 struct]
[1x18 struct] []
[] []
[1x18 struct] []
[] []
[1x18 struct] []
[1x18 struct] []
[1x18 struct] []
[1x18 struct] [1x18 struct]
[1x18 struct] []
[1x18 struct] [1x18 struct]
[1x18 struct] []
[] []
[1x18 struct] []
[1x18 struct] []
[1x18 struct] []
[1x18 struct] []
[1x18 struct] []
[1x18 struct] []
[1x18 struct] []
[1x18 struct] []
[] []
[1x18 struct] [1x18 struct]
2 件のコメント
Azzi Abdelmalek
2016 年 4 月 27 日
Is it a cell array or what? What is its size? do you mean to delete the entire row?
採用された回答
Azzi Abdelmalek
2016 年 4 月 27 日
V={5 [];4 6;[] 8;7 8;[] []}
idx=cellfun(@isempty,V)
V(any(idx,2),:)=[]
3 件のコメント
Azzi Abdelmalek
2016 年 5 月 9 日
編集済み: Azzi Abdelmalek
2016 年 5 月 9 日
If there are empty element, that means you haven't to delete them, because they don't exist, unless you mean to delete the zero elements, in this case
array=[1 0 0 2 3 5 6 0 2 8 0]
out=nonzeros(array)'
その他の回答 (1 件)
Elias Gule
2016 年 4 月 29 日
Now, try this
V = {1,2,[],[],23,16,'A',struct()}; % your cell array
V = V(~cellfun('isempty'),V);
2 件のコメント
Elias Gule
2016 年 5 月 9 日
Plz replace
V = V(~cellfun('isempty'),V);
with
V = V(~cellfun('isempty',V));
参考
カテゴリ
Help Center および File Exchange で Structures についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!