No need to use any loop. Try the following code.>> a={1:10, [2;4;6],[]} a = [1x10 double] [3x1 double] []>> a{cellfun(@isempty, a)} = 'non-empty now'a = [1x10 double] [3x1 double] 'non-empty now'You can see that calling "cellfun" with ...