function [StartTimeBlocks, EndTimeBlocks, Struct_Org] = CreatQTimeBlocks(Struct, TimeInterval) % [StartTimeBlocks, EndTimeBlocks, Struct_Org] = CreatQTimeBlocks(Struct, TimeInterval) % Input the OceanoSaltation struct "Struct" and time interval % Output non-overlapping starttime and endtime blocks and the orgaznied % saltation struct "Struct" with non-overlapping saltation items % Time interval is choosen as 30 minutes unless otherwise notified the1stblock = 1; Dates = Struct.Dates(the1stblock); StartTimeBlocks = Struct.StartTimes(the1stblock); EndTimeBlocks = Struct.EndTimes(the1stblock); Q = Struct.Q(the1stblock); sigma_Q = Struct.sigma_Q(the1stblock); ustRe = Struct.ustRe(the1stblock); sigma_ustRe = Struct.sigma_ustRe(the1stblock); theta = Struct.theta(the1stblock); temp_end = Struct.EndTimes(the1stblock); for i = the1stblock:length(Struct.Q) temp_start = Struct.StartTimes(i); if temp_start >=temp_end StartTimeBlocks = [StartTimeBlocks;temp_start]; Q = [Q; Struct.Q(i)]; sigma_Q = [sigma_Q; Struct.sigma_Q(i)]; ustRe = [ustRe; Struct.ustRe(i)]; sigma_ustRe = [sigma_ustRe; Struct.sigma_ustRe(i)]; theta = [theta; Struct.theta(i)]; temp_end = Struct.EndTimes(i); EndTimeBlocks = [EndTimeBlocks; temp_end]; end end Struct_Org.Q = Q; Struct_Org.sigma_Q = sigma_Q; Struct_Org.ustar = ustRe; Struct_Org.sigma_ustar = sigma_ustRe; Struct_Org.theta = theta; display('%--- function CreatQTimeBlocks() complete ----%'); end