Importing data from excel to matlab shift the dates by one day

조회 수: 2 (최근 30일)
Kristine
Kristine 2015년 1월 16일
댓글: Star Strider 2015년 1월 16일
Hi.
When I import data from excel to matlab the dates are shifted by one day. So in the excel file the first day is 01.01.10 but in matlab it start on 01.02.10. What could cause this error?
Help is greatly appreciated.
-Kristine

답변 (1개)

Star Strider
Star Strider 2015년 1월 16일
This is the only Answer I can find that seems to address your issue: Why do I see different results when passing dates from Excel into MATLAB?
The best and easiest solution seems to be to import the dates as strings, then convert them.
  댓글 수: 2
Kristine
Kristine 2015년 1월 16일
Do you think its possible to write a script where one day is subtracted instead?
Star Strider
Star Strider 2015년 1월 16일
Probably, but you’ll have to convert the dates to date numbers first anyway, or you have problems going across months. Import them as date numbers, add a day, and see what happens.
I always import the dates (and times, if times are provided) as strings if possible, then use datenum to convert the strings. No further conversion needed. Use the
[num,txt,raw] = xlsread(_)
syntax, so that you get the strings as well as the numeric data.
Also see the documentation on Import and Export Dates to Excel Files. Note that it describes the functionality of R2014b, so if you have an earlier version, some of it may not apply.

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

카테고리

Help CenterFile Exchange에서 Data Import from MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by