Is there an indexing way (I couldn't figure one out) to do what this little function does:
function nonempty = findNonEmpty(cellarray) % Find indices of non-empty array elements of cellarray
% Example:
% findNonEmpty({[], {3}, [], [], eye(100)}) returns [2 5]
nonempty = []; for i=1:length(cellarray) if ~isempty(cellarray{i}) nonempty(end+1) = i; end end
Best Answer