필터 지우기
필터 지우기

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Operators and Elementary Operations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by