Borrar filtros
Borrar filtros

count number of index in many vector

4 visualizaciones (últimos 30 días)
Firas Al-Kharabsheh
Firas Al-Kharabsheh el 2 de Abr. de 2016
Editada: Walter Roberson el 2 de Abr. de 2016
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 comentario
Jung Soo Park
Jung Soo Park el 2 de Abr. de 2016
Editada: Walter Roberson el 2 de Abr. de 2016
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

Iniciar sesión para comentar.

Respuestas (1)

Walter Roberson
Walter Roberson el 2 de Abr. de 2016
cellfun( @length, A)

Categorías

Más información sobre Matrix Indexing en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by