Importing data from excel to matlab shift the dates by one day
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (1)
Star Strider
le 16 Jan 2015
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 commentaires
Star Strider
le 16 Jan 2015
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.
Voir également
Catégories
En savoir plus sur Data Import from MATLAB 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!