data replace with NaN

조회 수: 4 (최근 30일)
Binu
Binu 2021년 6월 2일
댓글: Binu 2021년 6월 3일
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
Binu
Binu 2021년 6월 3일
Thank you Giuseppe. It worked. Great!!

댓글을 달려면 로그인하십시오.

채택된 답변

Giuseppe Inghilterra
Giuseppe Inghilterra 2021년 6월 2일
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.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 NaNs에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by