Can I create a dates?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Hi;
I would like create a matrix with only one colomn.
In my matrix I want to put the dates in this format 19890101 - 19890102 etc.
Each date must be written to seven times
(19890101,19890101,19890101,19890101,19890101,19890101,19890102,19890102,19890102,19890102,19890102,19890102,19890102,19890102 etc..). All this for 30 years.
I have to take account of the months with 28, 30 and 31 days and leap years.
Can you help me
Thanks
0 Commenti
Risposta accettata
Walter Roberson
il 24 Nov 2012
serdates = datenum('19890101', 'YYYYMMDD') : datenum('20191231');
vecdates = datevec(serdates);
decdates = vecdates(:,1) * 10000 + vecdates(:,2)*100 + vecdates(:,3);
datecol = reshape( repmat(decdates(:) .', 7, 1), [], 1);
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Dates and Time in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!