フィルターのクリア

Replacing values in a column with a conditional statement.

2 ビュー (過去 30 日間)
Benju Baniya
Benju Baniya 2022 年 7 月 19 日
回答済み: Walter Roberson 2022 年 7 月 19 日
Hi I am new to matlab and not so familiar with conditional statemet. In the data below, I want to change NEE value based on a condition: Accept the NEE value if NEE_fc == 0 or 1 and substitute NEE values with -9999 if NEE_fc is > 0 or 1. Help will be much appreciated.
Data looks like this
Date NEE NEE_fc
2018 -0.2 0
2018 0.2 1
2018 0.3 2
2018 -0.002 3
Desired result
Date NEE NEE_fc
2018 -0.2 0
2018 0.2 1
2018 -9999 2
2018 -9999 3

回答 (1 件)

Walter Roberson
Walter Roberson 2022 年 7 月 19 日
mask = NNE_fc > 1;
NNE(mask) = -9999;

カテゴリ

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

製品

Community Treasure Hunt

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

Start Hunting!

Translated by