フィルターのクリア

count number of index in many vector

4 ビュー (過去 30 日間)
Firas Al-Kharabsheh
Firas Al-Kharabsheh 2016 年 4 月 2 日
編集済み: Walter Roberson 2016 年 4 月 2 日
if i have
A{1} = 2
8
1
1
then the solution will be 4
A{2} = 1
3
5
4
5
2
then the solution will be 6
A{3} = 4 5 3 2 5 3 1
then the solution will be 7
i need this solution for A{k}
  1 件のコメント
Jung Soo Park
Jung Soo Park 2016 年 4 月 2 日
編集済み: Walter Roberson 2016 年 4 月 2 日
I hope this is what you want..
I assume k=4 and made A{4} with 14 numbers and expected so expected solution is 14.
k=4;
A=[];
A{1}=[2;8;1;1] ;
A{2}=[1;3;5;4;5;2];
A{3} = [4,5,3,2,5,3,1];
A{4}=[4,5,3,2,5,3,1,4,5,3,2,5,3,1];
S=zeros(1,k);
for i=1:k
s=(size(A{i}));
S(1,i)=max(s);
end
S

サインインしてコメントする。

回答 (1 件)

Walter Roberson
Walter Roberson 2016 年 4 月 2 日
cellfun( @length, A)

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by