Azzera filtri
Azzera filtri

Indexing for cell arrays

1 visualizzazione (ultimi 30 giorni)
Joseph Lee
Joseph Lee il 20 Nov 2017
Commentato: Joseph Lee il 22 Nov 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]

Risposta accettata

Walter Roberson
Walter Roberson il 20 Nov 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 Commenti
Walter Roberson
Walter Roberson il 21 Nov 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 il 22 Nov 2017
Only the min out of all the M, one single value.

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Matrices and Arrays in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by