Borrar filtros
Borrar filtros

Find the different elements in a cell array

3 visualizaciones (últimos 30 días)
LL
LL el 23 de Nov. de 2021
Comentada: LL el 29 de Nov. de 2021
Hi to all,
i have a problem because i have a cell array and i need to find the cells that contain both numbers 1 and 2.
Thanks.

Respuesta aceptada

Stephen23
Stephen23 el 23 de Nov. de 2021
Editada: Stephen23 el 23 de Nov. de 2021
Where out is your cell array:
fnh = @(v) any(v(:)==1)&&any(v(:)==2);
idx = cellfun(fnh,out)
  12 comentarios
Stephen23
Stephen23 el 29 de Nov. de 2021
@Lidia Frizzi: please show the expected result of that "merging".
LL
LL el 29 de Nov. de 2021
So for example in the rows 6-7 and colums 8-9 i have three cells not empty the result that i would like to obtain is like this.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Creating and Concatenating Matrices 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