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 ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by