MATLAB: Optimise for loop in using cell array

cell arrayfor loopoptimization code

Is it possible to do same without for loop?
lengthboundaries=zeros(length(boundaries),1);
for i=1:length(boundaries)
lengthboundaries(i)=length(boundaries{i});
end

Best Answer

lengthboundaries = cellfun(@length,boundaries);