Cutoff Threshold of data points
4 views (last 30 days)
Show older comments
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 Comments
Answers (1)
Image Analyst
on 6 Mar 2022
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 Comments
See Also
Categories
Find more on Numeric Types in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!