Couldn't find what's wrong

1 vue (au cours des 30 derniers jours)
IBM watson
IBM watson le 22 Mar 2019
Commenté : madhan ravi le 22 Mar 2019
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.

Réponse acceptée

madhan ravi
madhan ravi le 22 Mar 2019
Modifié(e) : madhan ravi le 22 Mar 2019
q = 3;
b = find( cellfun( @numel, a ) == q )
%or
b = find( cellfun( 'prodofsize', a ) == q )
  2 commentaires
IBM watson
IBM watson le 22 Mar 2019
thanks but what is q=3 for ?
madhan ravi
madhan ravi le 22 Mar 2019
Refers to number of elements you can change it accordig to your desire.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Matrices and Arrays dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by