How do I filter out a row in a cell array
4 次查看(过去 30 天)
显示 更早的评论
I have a 83x10 cell array. I want to filter the rows by a certain column value, namely whether a column is empty or not (by empty I mean it has the `[]` value).
How do I do this?
0 个评论
采纳的回答
Akira Agata
2017-7-16
You can do this with cellfun function, like:
% 83x10 sample cell array
C = num2cell(rand(83,10));
% Set some empty cell
C(2,3) = {''};
C(5,2) = {''};
% Identify empty cells
idx = cellfun(@isempty, C);
% Delete rows with empty cell
C(any(idx,2),:) = [];
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Cell Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!