How can I import dates from Excel using xlsread?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have a column of dates in an Excel file in the format of mm/dd/yyy. They are in a table and are listed from largest to smallest. Ultimately I'd like to import this column of dates along with corresponding data in another column and graph it using MatLab. I have the following:
unsub_2011_date = xlsread(unsub_2011.xlsx,Sheet 1,A4:A16);
unsub_2011_balance = xlsread(unsub_2011.xlsx,Sheet 1,G4:G16);
Doing so, my output for unsub_2011_date is:
>>[]
Then I'd like to repeat for other .xlsx files with different years where I just copy and paste the code and change the "year". Additionally, is there a more efficient way to read this data/removing a lot of my code? After the data is imported, how do I graph it so it's chronological?
Thanks
0 commentaires
Réponses (1)
Walter Roberson
le 19 Mar 2018
Modifié(e) : Walter Roberson
le 19 Mar 2018
"I have a column of dates in an Excel file in the format of mm/dd/yyy"
are they stored in Excel as strings, or are they stored in Excel in Excel data format with a cell format applied to make them appear in that form?
Because if they are stored as string then they are going to be removed from the first output of xlsread(): you would need either the second or third output of xlsread() for strings.
Have you tried using readtable() ?
0 commentaires
Voir également
Catégories
En savoir plus sur Spreadsheets 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!