user1742463
user1742463

Reputation: 161

manipulation of a cell array-

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

Answers (1)

Andrey Rubshtein
Andrey Rubshtein

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

Related Questions