Effacer les filtres
Effacer les filtres

data replace with NaN

3 vues (au cours des 30 derniers jours)
Binu
Binu le 2 Juin 2021
Commenté : Binu le 3 Juin 2021
Hi ,
I think this is simple, but I am struggling to do this.
I have a data set as shown in the image, but with some bad data. I want to replace the data between the two data cursors with NaN. Appreciate your thoughts.
Thank you
  1 commentaire
Binu
Binu le 3 Juin 2021
Thank you Giuseppe. It worked. Great!!

Connectez-vous pour commenter.

Réponse acceptée

Giuseppe Inghilterra
Giuseppe Inghilterra le 2 Juin 2021
Hi,
I would do in the following way:
y(x>=2.519e6 & x<=2.52e6) = NaN;
In this way I overwrite the current values of y vector with NaN ones in the x specified range (I consired your plot to define the x range). The expression x>=2.519e6 & x<=2.52e6 returns a logical array, that identifies the indices of y vector, that I want to overwrite.
Hope this helps.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by