IRIS dates to Matlab dates

Topics: Dates
Aug 22, 2014 at 9:15 PM
Hi,

I'm using a package that requires dates to be in string format ie '1985-01-01'. Now is there a way to convert monthly or quarterly IRIS dates to that format?

I've been trying:
DataXdate = dat2str(mm(1981,1):mm(2014,3),'dateFormat','YYYY-MM-DD')
DataXdate = strcat(DataXdate, '01')
It works but is not very elegant. Is there a better way?
Coordinator
Aug 22, 2014 at 9:29 PM
In general using sprintf() is much faster tan using strcat(). I don't know about more elegant.
Coordinator
Aug 22, 2014 at 9:35 PM
This will do the job:
DataXdate = dat2str(mm(1981,1):mm(2014,3),'dateFormat','YYYY-MM-01')
Marked as answer by jaromirbenes on 8/22/2014 at 2:35 PM
Coordinator
Aug 22, 2014 at 9:38 PM
Very nice!