Clear Filters
Clear Filters

why isn´t datevec accepting strings like this one: "12-12-2012 00:00"?

1 view (last 30 days)
Hi guys,
I used datevec before but never with a string that points to midnight.
I have an array like this one:
01-06-2014 00:00,
01-06-2014 00:10,
01-06-2014 00:20,
01-06-2014 00:30,
01-06-2014 00:40,
02-06-2014 00:00,
02-06-2014 00:10,
02-06-2014 00:20,
02-06-2014 00:30,
02-06-2014 00:40]
the thing is: datevec doesn´t recognize any of the strings that have 00:00 and i don´t know why...
Does anyone know what to do?
Thanks is advance!
Inês

Accepted Answer

Ingrid
Ingrid on 2 Jun 2015
I do not seem to be able to reproduce your problem. Are you sure you are providing strings to datevec (as this is not the case in your example)
datevec({'01-06-2014 00:00', '01-06-2014 00:10', '01-06-2014 00:20',...
'01-06-2014 00:30', '01-06-2014 00:40', '02-06-2014 00:00',...
'02-06-2014 00:10', '02-06-2014 00:20', '02-06-2014 00:30', '02-06-2014 00:40'})
ans =
2014 1 6 0 0 0
2014 1 6 0 10 0
2014 1 6 0 20 0
2014 1 6 0 30 0
2014 1 6 0 40 0
2014 2 6 0 0 0
2014 2 6 0 10 0
2014 2 6 0 20 0
2014 2 6 0 30 0
2014 2 6 0 40 0
  2 Comments
Inês Mendes
Inês Mendes on 2 Jun 2015
yes..i have an excel in which the first column is a column with the date. When I extract it, the first column is a string array..then i try to use datevec and i doesn´t work...if i eliminate the first row it works because matlab doesn´t come across the 00:00 string..the thing is that in the middle of the array i have other 00:00 strings..
Ingrid
Ingrid on 2 Jun 2015
than the problem is not with datevec but with the way the excel data is imported, how do you do this and what is the resulting column?

Sign in to comment.

More Answers (0)

Categories

Find more on Dates and Time in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!