Datetime vectors in Matlab / Octave

Generating a range of datetime data is a common data analysis and simulation task across programming languages. Matlab and GNU Octave can also generate datetime vectors.

Matlab datetime deprecates datenum. Generate a sequence of datetime like:

t0 = datetime('2020-01-05 12:30:00');
t1 = datetime('2020-01-06 18:15:10');
dt = hours(5.5);

t = t0:dt:t1;

disp(t)

GNU Octave can use many datetime features via the tablicious package.

pkg install -forge tablicious

Load in Octave prompt:

pkg load tablicious

Then use the same Matlab code above.