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

 채택된 답변

Andrei Bobrov
Andrei Bobrov 2017년 8월 5일

1 개 추천

lengthboundaries = cellfun(@length,boundaries);

댓글 수: 2

Jan
Jan 2017년 8월 5일
편집: Jan 2017년 8월 5일
+1. Or even faster:
lengthboundaries = cellfun('length', boundaries);
Ilida Suleymanova
Ilida Suleymanova 2017년 8월 5일
Wow. thanks!

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Problem-Based Optimization Setup에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by