function [ws_sep, date_time_sep, ind_sep] = interval_sep(ws, date_time, interval)

if (length(size(ws))~=2 | length(size(date_time))~=2) || (min(size(ws))~=1 | min(size(date_time))~=1) || length(ws)~=length(date_time)
    error('The first and second input arguments must be vectors with the same length');
end
    
ws_sep= ws(:);
date_time_sep = date_time(:);
ind_sep = reshape(1:length(ws_sep),size(ws_sep));

p = 1; % index
while p <= length(ws_sep)-1
    if date_time_sep(p+1) - date_time_sep(p)< interval
        if ws_sep(p)>= ws_sep(p+1)
            % keep the pth wind speed, delete the (p+1)th:
            ws_sep = [ws_sep(1:p);ws_sep(p+2:end)]; % NOTE: if p+2>length(ws_sep), then ws_sep(p+2:end) is empty, no error results
            date_time_sep = [date_time_sep(1:p);date_time_sep(p+2:end)];
            ind_sep = [ind_sep(1:p);ind_sep(p+2:end)];
        else
            % keep the (p+1)th wind speed, delete the pth:
            if p>1
                ws_sep = [ws_sep(1:p-1);ws_sep(p+1:end)];
                date_time_sep = [date_time_sep(1:p-1);date_time_sep(p+1:end)];
                ind_sep = [ind_sep(1:p-1);ind_sep(p+1:end)];
            else
                ws_sep = ws_sep(2:end);
                date_time_sep = date_time_sep(2:end);
                ind_sep = ind_sep(2:end);
            end
        end
    else 
        p = p+1;
    end
end