In a matrix column/array, how can I turn all numbers higher than a certain value into nans?

6 ビュー (過去 30 日間)
I have a 1 D array (column) of measured data (that I ultimately append to a matrix). I want to plot the data.
There are numbers higher than "1.0" in the array and they mean that there was a problem with a measurement. I need to turn any numbers higher than 1.0 into nans. Does anyone know how to do this? Thank you for any advice.

採用された回答

Abdolkarim Mohammadi
Abdolkarim Mohammadi 2020 年 9 月 2 日
編集済み: Abdolkarim Mohammadi 2020 年 9 月 2 日
The best way is to use logical indexing.
X(X>1) = NaN;
Read this page, especially Indexing with Logical Values:
  1 件のコメント
Srh Fwl
Srh Fwl 2020 年 9 月 2 日
Thank you very much! Really appreciate the link to the documentation page. I had no idea what terms to search.

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

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by