express datetime from now, every 3h
Mostra commenti meno recenti
code is
---------------------------------------------------------------
t = datetime('now','TimeZone','local','Format','y-MMM-d HH');
---------------------------------------------------------------
In command,
---------------------------------------------------------------
t = 2016-Oct-31 00
---------------------------------------------------------------
But I want to express in command
---------------------------------------------------------------
t_1 = 2016-Oct-30 00
t_2 = 2016-Oct-30 03
t_3 = 2016-Oct-30 06
---------------------------------------------------------------
every 3 hour
.
.
.
please help me
Risposta accettata
Più risposte (1)
Steven Lord
il 30 Ott 2016
Don't create individual variables. Instead use the colon operator to create a vector.
N = datetime('now');
d = N:hours(3):(N+days(1));
% or
d = N + hours(0:3:24);
1 Commento
Jeong_evolution
il 3 Nov 2016
Categorie
Scopri di più su Programming in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!