Produce a Date vector starting with a desired date
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Christoph Meier
il 11 Ago 2015
Commentato: Star Strider
il 11 Ago 2015
Dear all, I am trying to produce a date vector, which includes year and month I would like to start With July 1926, and end with December 2014. Optimally, the format should be YYYYMM.
Thank you very much in advance!
Chris
Risposta accettata
Star Strider
il 11 Ago 2015
This seems to work:
date1 = datenum('192607','yyyymm');
date2 = datenum('201412','yyyymm');
datev = date1:(365.25/13):date2;
result = unique(datestr(datev, 'yyyymm'),'rows');
sample = result(1:24,:) % Sample Output
2 Commenti
Più risposte (1)
Azzi Abdelmalek
il 11 Ago 2015
d1='192607'
d2='201412'
dd1=datenum(d1,'yyyymm')
dd2=datenum(d2,'yyyymm')
out=datestr(dd1:dd2,'yyyymm')
Vedere anche
Categorie
Scopri di più su Time Series Objects in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!