a=cell(1,3)
a{2}= [2 4 5]
for i=1:3
if numel(a{i})==3
b=cellfun(@(q) q==a(i),a,'un',1)
end
end
I tried to find index of the matrix which have a certain number of elements in a cell.

 Respuesta aceptada

madhan ravi
madhan ravi el 22 de Mzo. de 2019
Editada: madhan ravi el 22 de Mzo. de 2019

1 voto

q = 3;
b = find( cellfun( @numel, a ) == q )
%or
b = find( cellfun( 'prodofsize', a ) == q )

2 comentarios

IBM watson
IBM watson el 22 de Mzo. de 2019
thanks but what is q=3 for ?
madhan ravi
madhan ravi el 22 de Mzo. de 2019
Refers to number of elements you can change it accordig to your desire.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Matrices and Arrays en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 22 de Mzo. de 2019

Comentada:

el 22 de Mzo. de 2019

Community Treasure Hunt

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

Start Hunting!

Translated by