Reputation: 161
I have a cell array where some cells are empty, some are with numbers and some are with strings and chars. I want to find out which ones are empty- is there a better way then a double loop with the following formula:
isempty(cell_array{i,j})
Upvotes: 1
Views: 126
Reputation: 20915
Yes, there is:
emptyList = cellfun(@isempty, yourCellArrayHere);
It is more compact, and Matlab-like style. In practice, it is not guaranteed to be faster, due to JIT optimizations of for
loops.
Upvotes: 1