make incorrect values as nan

8 ビュー (過去 30 日間)
Richard
Richard 2012 年 1 月 8 日
I have a data set of temperature which has an usual range between 0 and 20 degreesC. Some of the data is incorrect and gives readings which are obviously wrong. So, I want to write a command which states that if a reading is 1 degreeC different to the one prior to it, the reading should be changed to a nan.
How is this possible?

採用された回答

Andrew Newell
Andrew Newell 2012 年 1 月 8 日
Here is one way:
I = find(diff(T)>1);
T(I+1)=NaN;
EDIT: And here is another using logical indexing:
T([1 diff(T)>1]) = NaN;
  1 件のコメント
Walter Roberson
Walter Roberson 2012 年 1 月 8 日
Possibly >= instead of > for the comparisons.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by