フィルターのクリア

Change negative values in data

1 回表示 (過去 30 日間)
PureFleet
PureFleet 2021 年 11 月 29 日
コメント済み: PureFleet 2021 年 11 月 29 日
Hello,
I have made a variable to show when my data is negative and to write NaN but I need it to show that on the original data. Any tips on how I can do this?
invalidDataIndex=[windTurbineData.mean_Power_kW<0]==1
for a = find(invalidDataIndex == 1)
a(invalidDataIndex) = NaN
end

採用された回答

dpb
dpb 2021 年 11 月 29 日
You're almost there, but making it more complicated than needs be...
invalidDataIndex=(windTurbineData.mean_Power_kW<0); % the result is logical array already
windTurbineData.mean_Power_kW(invalidDataIndex) = NaN; % use logical indexing
Of course, you don't even need the temporary index at all, just a logical indexing expression...
windTurbineData.mean_Power_kW(windTurbineData.mean_Power_kW<0) = NaN; % use logical indexing
  1 件のコメント
PureFleet
PureFleet 2021 年 11 月 29 日
Thank you!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeOperators and Elementary Operations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by