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

 Réponse acceptée

Andrei Bobrov
Andrei Bobrov le 5 Août 2017
lengthboundaries = cellfun(@length,boundaries);

2 commentaires

Jan
Jan le 5 Août 2017
Modifié(e) : Jan le 5 Août 2017
+1. Or even faster:
lengthboundaries = cellfun('length', boundaries);
Ilida Suleymanova
Ilida Suleymanova le 5 Août 2017
Wow. thanks!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

Community Treasure Hunt

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

Start Hunting!

Translated by