Problem with ''if''

5 views (last 30 days)
alexis
alexis on 20 Jul 2011
Hi everyone, I have this variable:
values =
[] [1x27 char] [1x32 char] [1x28 char] [1x34 char]
and i want have a check for empty cells. I use :
if values[ ]==[ ]
....
end
But unfortunately....
??? Conversion to logical from cell is not possible. What can i do???

Accepted Answer

Robert Cumming
Robert Cumming on 20 Jul 2011
cellfun ( @isempty, values )
  5 Comments
Oleg Komarov
Oleg Komarov on 20 Jul 2011
idx = cellfun('isempty',values);
find(~idx,1,'first')
Finds the location of the first non-empty.
alexis
alexis on 21 Jul 2011
Thank you!!!

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!