# MATLAB: How to find maximum value of each event present in a series

MATLAB and Simulink Student Suite

I have a series of 30 min interval rainfall data. The data are divided in monthly basis (one month data is attached). The series is consist of various rainfall events (rainfall events are shown in picture attached herewith). Now I would like to find out a series that consist of the maximum value of each rainfall event. (A rainfall event is basically identified by Continuous non zero value).

data = readtable('2000.xlsx');data.Date = fillmissing(data.Date,'previous'); % assume the data is in ascending order of timedata.Date = data.Date + days(data.Time);data.Date.Format = 'dd-MM-yy hh:mm';data.Event_id = cumsum(data.Intensity_cm_hr_ == 0); % create a new event if intensity goes to 0data_summary = groupsummary(data,{'Event_id'},{'min' 'max'},{'Intensity_cm_hr_' 'Date' 'Date'});data_summary(data_summary.max_Intensity_cm_hr_==0,:) = []; % remove 'events with 0 intensitydata_summary.Properties.VariableNames(:,5:6) = {'start_Date' 'end_Date'};