How can i find which value of a cell equals to 1?
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Volkan Yangin
le 7 Oct 2016
Commenté : Jakub Rysanek
le 9 Oct 2016
Hi everbody,
I have a cell array includes [] and 1 elements and i want to find which cell equals to 1. (For ex. 220. cell equals 1.)
Thanks...
0 commentaires
Réponse acceptée
Massimo Zanetti
le 7 Oct 2016
If in your cell you have only [] or 1 elements, this works.
C={1,[],[],1,[],1}
%get indeces of 1s
OnesInC = find(~cell2mat(cellfun( @(x) isempty(x) , C , 'UniformOutput' , false )))
Otherwise, let me know.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Cell Arrays dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!