Borrar filtros
Borrar filtros

Indexing for cell arrays

1 visualización (últimos 30 días)
Joseph Lee
Joseph Lee el 20 de Nov. de 2017
Comentada: Joseph Lee el 22 de Nov. de 2017
I have 10x1300 cell array z, how do i find a certain value of z using indexing
find(abs(z-z_position)<intvl) did not work
and how do i do the opposite as well? eg. z{1,1}(1)
A portion of z, z value is random for each cell.
Columns 1296 through 1300
[1×23 double] [1×23 double] [1×29 double] [1×23 double] [1×25 double]
[1×27 double] [1×25 double] [1×25 double] [1×25 double] [1×27 double]
[1×21 double] [1×25 double] [1×27 double] [1×27 double] [1×25 double]
[1×27 double] [1×29 double] [1×29 double] [1×25 double] [1×23 double]
[1×27 double] [1×25 double] [1×23 double] [1×27 double] [1×27 double]
[1×27 double] [1×27 double] [1×23 double] [1×21 double] [1×23 double]
[1×25 double] [1×29 double] [1×27 double] [1×27 double] [1×27 double]
[1×27 double] [1×21 double] [1×21 double] [1×29 double] [1×27 double]
[1×25 double] [1×25 double] [1×25 double] [1×21 double] [1×27 double]
[1×23 double] [1×25 double] [1×25 double] [1×25 double] [1×23 double]

Respuesta aceptada

Walter Roberson
Walter Roberson el 20 de Nov. de 2017
cellfun( @(Z) find(abs(Z-z_position)<intvl), z, 'uniform', 0)
the output will be a cell array each element of which is the list of indices for the corresponding cell in z.
  9 comentarios
Walter Roberson
Walter Roberson el 21 de Nov. de 2017
Do you need to know just the value out of all of the M, or do you need to know which cell of M it came from and the index inside that cell?
Joseph Lee
Joseph Lee el 22 de Nov. de 2017
Only the min out of all the M, one single value.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Matrices and Arrays en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by