Effacer les filtres
Effacer les filtres

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

1 vue (au cours des 30 derniers jours)
Inês Mendes
Inês Mendes le 2 Juin 2015
Modifié(e) : per isakson le 4 Juin 2015
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

Réponse acceptée

Ingrid
Ingrid le 2 Juin 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 commentaires
Inês Mendes
Inês Mendes le 2 Juin 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 le 2 Juin 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?

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Dates and Time dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by