MATLAB: Creating time vector intervalstime series silly question. how to create time series vector for a period of one specific date(say 2 February 2010) to some specific date(11 November 2010) with an interval of one second, one minute, 1 hour,3 hours etc? Best Answer https://www.mathworks.com/help/matlab/matlab_prog/generate-sequence-of-dates-and-time.htmlhttps://www.mathworks.com/help/matlab/ref/duration.htmlt1 = datetime(2010,02,02);t2 = datetime(2010,11,11);t1:seconds(1):t2t1:minutes(1):t2t1:hours(1):t2t1:hours(3):t2 Related SolutionsMATLAB: How to find time difference between two times The etime function does exactly what you want. You have to convert your times to date vectors first:t1={'01-Oct-2011 11:12:00'};t2={'01-Oct-2011 11:15:00'};t11=datevec(datenum(t1));t22=datevec(datenum(t2));time_interval_in_seconds = etime(t22,t11)time_interval_in_seconds = 180.0000 MATLAB: Jump datetime in graphs and tables You mean generate a series of some time difference (like three months above)???dat=datetime(2010,2:3:9*12,1).';dat.Format='MM/yyyy';>> dat(1:5)ans = 5×1 datetime array 02/2010 05/2010 08/2010 11/2010 02/2011>> Related QuestionGenerate time sequence with 15 minutes step timeCount Days in MonthsHow to set datetime for every 9.9156 daysChanging the xticks in a heatmap to a datetime ticks
Best Answer