how to read excel data in matlab?

1 次查看(过去 30 天)
SONI SONI
SONI SONI 2016-3-15
I have daily time series data for 10 year in excel sheet (365 values in every year). Now I want to monthly sum this daily data and create a monthly time series (12 values of every year). How to import this excel sheet in matlab? I imported the excel sheet in matlab using import tool but, matlab is not reading format of date.
Example: Date data
01-01-2000 45
02-01-2000 25
03-01-2000 88..............
31-01-2000 56
01-02-2000 69
02-02-2000 28
03-02-2000 63..............
28-02-2000 91
  3 个评论
Explorer
Explorer 2016-3-15
编辑:Explorer 2016-3-15
Upload your excel file and your code file to let others help you in a better way.
Helen Kirby
Helen Kirby 2016-4-15
This is what I did: Change your DD-MM-YYYY format in your Excel file to MM/DD/YYYY or MM/DD/YY. When it is in this form you can add the constant 695422 to change it from the XL date number to the ML date number. Say your XL date is in J4, you use (J4)+695422. You should keep the XL date around because it is a nuisance to keep having to work out the date from 736085 e.g. After you have a column of ML dates, read in the file as Explorer says above then start picking out your months as you require. You may need "Datevec" for that process.

请先登录,再进行评论。

回答(1 个)

Walter Roberson
Walter Roberson 2016-4-15
If you are using R2014b or later, use readtable() and the times will be converted to datetime objects.
If you are using R2013b or R2014a then readtable() still exists but there will be no automatic conversion of the times to time objects.

Community Treasure Hunt

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

Start Hunting!

Translated by