필터 지우기
필터 지우기

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

조회 수: 1 (최근 30일)
Inês Mendes
Inês Mendes 2015년 6월 2일
편집: per isakson 2015년 6월 4일
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

채택된 답변

Ingrid
Ingrid 2015년 6월 2일
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
Inês Mendes
Inês Mendes 2015년 6월 2일
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 2015년 6월 2일
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?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Dates and Time에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by