Cutoff Threshold of data points
조회 수: 4 (최근 30일)
이전 댓글 표시
I have calculated the sum of rainfall per rainfall event [RF_Total(x,:) ] and the sum of hours in that event [RF_Hours(x,:)]. I would like to remove rainfall events that are greater that 50.8 mm and more than 51h. This is what I've developed thus far.
(I've attached a compressed file containing the data that you would need for line 1 )
M1 = readmatrix('Pevents.txt'); % Text File to Matrix
NaNv = find(isnan(M1)); % Numeric Indices Of 'NaN' Values
NaNv = [NaNv; size(M1,1)]; % Last Index (Instead Of Last 'NaN') Is The End Of The Vector
Events = 1:numel(NaNv)-1;
for x = Events
idxrng = NaNv(x)+2:NaNv(x+1)-1;
RF_Vector{x,:} = M1(idxrng); % Vector Of Rainfall Events (Between 'NaN' Elements)
RF_Hours(x,:) = numel(idxrng); % Number Of Hours In Each Event (h)
RF_Total(x,:) = sum(M1(idxrng)); % Sum Of Rainfall Data (mm)
end
t_holdrain = 50.8; % Cutoff Threshold of Rainfall Data(mm)
t_holdhr = 51; % Cutoff Threshold of Hourly Rainfall(h)
y(x,:) = RF_Total(x,:);
z(x,:) = RF_Hours(x,:);
if y(y > t_holdrain)& z(z > t_holdhr) % Excluding rainfall greater than the threshold
end
댓글 수: 0
답변 (1개)
Image Analyst
2022년 3월 6일
Try this:
y(x,:) = RF_Total(x,:);
z(x,:) = RF_Hours(x,:);
% Determine what rows we want to eliminate.
rowsToDelete = (y > t_holdrain) & (z > t_holdhr); % Excluding rainfall greater than the threshold
% Now remove them from y and z
y(rowsToDelete, :) = [];
z(rowsToDelete, :) = [];
댓글 수: 5
참고 항목
카테고리
Help Center 및 File Exchange에서 Numeric Types에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!