How can i find which value of a cell equals to 1?
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Volkan Yangin
el 7 de Oct. de 2016
Comentada: Jakub Rysanek
el 9 de Oct. de 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 comentarios
Respuesta aceptada
Massimo Zanetti
el 7 de Oct. de 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.
2 comentarios
Jakub Rysanek
el 9 de Oct. de 2016
Or you can do it 20x times:
find(~cellfun('isempty',C));
Más respuestas (0)
Ver también
Categorías
Más información sobre Line Plots 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!