Reputation: 83
I am using MATLAB R2015b. I am trying to import a excel file full of dates using xlsread('filename.xls')
. The dates looks like the followings:
02/01/1996
03/01/1996
04/01/1996
05/01/1996
08/01/1996
then I want use datevec to separate the day month and year. for date = '02/01/1996'(January 2nd 1996), datevec
gives Y= 1996, M = 2, D= 1,H=0 MN=0 S=0
. For date '29/12/2000' (Dec 29 2000), datevec gives Y = 35, M=5 D =23 H=0 MN=0 S=0
.
I tried to change the date format in excel, but it still does not work. Can anyone let me know how can I fix this please?
Upvotes: 0
Views: 174
Reputation: 18177
DateVector = datevec(DateString,formatIn)
As per the documentation. Set your formatIn
correct:
DateString = {'16/09/2007';'14/05/1996';'29/11/2010'};
formatIn = 'dd/mm/yyyy';
datevec(DateString,formatIn)
Since MATLAB is an American program all their defaults are American (hence you're not able to call your colourbar
as you want to). You just have to select a different date format.
Upvotes: 2