Start Cumsum from table of values that correspond with given indeces
5 views (last 30 days)
Show older comments
Jonathan Cheong on 16 Dec 2020
Commented: Jonathan Cheong on 28 Dec 2020
Hello, I have a timetable of values called ddtable with column 'RAIN' and an array of index called startdd.
1) If index of ddtable matches with startdd, start cumsum for subsequent RAIN values until it exceeds 3.5 then stop.
2) Append all indices that were involved in the cumsum into a new table
How do I go about this because traditional while loop does not work as well and no discussion have addressed this type of question.
for ii = 1:length(rain)
% If rain index matches with startdd, start cumulation
if idx(rain) == startdd
% The cumulation will end once it exceeds 3.5mm
while cumsum(rain(startdd)) < 3.5
% Append all index values that were involved in the cumsum
Find more on Descriptive Statistics 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!