Problem with ''if''

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???

 采纳的回答

cellfun ( @isempty, values )

5 个评论

Jan
Jan 2011-7-20
CELLFUN('isempty') is remarkably faster than CELLFUN(@isempty).
thank you for the answer but... I want my programme to stop when i have an non empty cell. I wan't to check the "values" and if the "values"is empty then i 'll continue my programme. Can you help me??
presumably you have a for loop then so that you can stop/break? i.e.
for ii=1:length(values)
if isempty ( values{ii} )
break
end
end
idx = cellfun('isempty',values);
find(~idx,1,'first')
Finds the location of the first non-empty.
Thank you!!!

请先登录,再进行评论。

更多回答(0 个)

类别

帮助中心File Exchange 中查找有关 Data Type Conversion 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by