function [StartTimes,EndTimes] = TimeSeriesContinuous(Struct) % [StartTimes, EndTimes] = TimeSeriesContinuous(Struct) % To check if time series of June 5,6 and 7, 2015 are continous every second % , for example, between 06-Jun-2015 10:25:00 and 06-Jun-2015 10:25:05 % there are 5 seconds, instead of 10 seconds % and to return two datetime format vectors 'StartTimes' and 'EndTimes' StartTimes = []; EndTimes = []; for j = 1:3 for i = 1:5 temp_start = Struct.(['D',num2str(i)])(j).t.raw(1); temp_end = Struct.(['D',num2str(i)])(j).t.raw(end); length_in_seconds = seconds(temp_end-temp_start) + 1; % for every recond, how many seconds inbetween the start second and the end second temp_length = length(Struct.(['D',num2str(i)])(j).t.raw); % for every recond, how many seconds as matrix size if length_in_seconds == temp_length fprintf(['Sensor D',num2str(i),' - June ',num2str(j+4),... ' is continous in seconds, with ',num2str(length_in_seconds),... ' seconds in total \n']); else fprintf(['Sensor D',num2str(i),' - June ',num2str(j+4),... ' is NOT continous in seconds, DOUBLE CHECK!!! \n']); end end StartTimes = [StartTimes; temp_start]; EndTimes = [EndTimes; temp_end]; end display('%--- function TimeSeriesContinuous() complete ----%'); end