MATLAB: comment mapper des éléments consécutifs à une valeur vectorielle

Salut –
I’m a bit of a novice, and could use a hand. I have a data set, which I have manipulated to output row and column indices in two variables (I used [r,c,v]=find(1 < X & X < 5), to generate the row and column indices). I also have two vectors, a 1 x 41 that corresponds to the number of total columns (t), and another 22198 x 1 that corresponds to the total number of rows (m). What I would like is for the final product to be a two column list with ‘m’ as column 1 and ‘t’ as column 2. Is there a way to relate the values in ‘r’ to the values in ‘m’ (the same for ‘c’ and ‘t’)? For instance, any time a ‘1’ is observed in ‘r’, the value of the first element in ‘m’ is returned, thus generating a peak list of sorts.
Merci d’avance à tous.

Meilleure réponse

  • C’est facile,
    r et c sont l’indice de ligne et de colonne de X. Je suppose que X est de taille 22198×41, (puisque votre m est 22198 et votre t est 41); Donc, si vous voulez obtenir les numéros correspondants, faites-le
     

    m(r)
    t(c)