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

 채택된 답변

Robert Cumming
Robert Cumming 2011년 7월 20일

0 개 추천

cellfun ( @isempty, values )

댓글 수: 5

Jan
Jan 2011년 7월 20일
CELLFUN('isempty') is remarkably faster than CELLFUN(@isempty).
alexis
alexis 2011년 7월 20일
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??
Robert Cumming
Robert Cumming 2011년 7월 20일
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
Oleg Komarov
Oleg Komarov 2011년 7월 20일
idx = cellfun('isempty',values);
find(~idx,1,'first')
Finds the location of the first non-empty.
alexis
alexis 2011년 7월 21일
Thank you!!!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터 및 File Exchange에서 Cell Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by