Importing data from excel to matlab shift the dates by one day
2 ビュー (過去 30 日間)
古いコメントを表示
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
0 件のコメント
回答 (1 件)
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 件のコメント
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 Center および File Exchange で Data Import from MATLAB についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!