2
How do I import data from an excel spreadsheet that contains date and time (e.g.: 10/22:45:10) in Matlab?
2
How do I import data from an excel spreadsheet that contains date and time (e.g.: 10/22:45:10) in Matlab?
2
Recommend:
For the latter, I will show how to import an excel file containing dates to a table in Matlab. Be the hypothetical.xls weight file with the following data.
Data Peso
___________ ______
31-Oct-1996 174.8
29-Nov-1996 179.3
30-Dec-1996 190.4
31-Jan-1997 185.7
Now do the following.
T = readtable('weight.xls')
T =
Data Peso
____________ ______
'10/31/1996' 174.8
'11/29/1996' 179.3
'12/30/1996' 190.4
'1/31/1997' 185.7
In windows, with Excel, the Data variable is a string field of the Cell array. To convert it just do:
T.Data = datetime(T.Data,'Inputformat','MM/dd/yyyy')
T =
Data Peso
___________ ______
31-Oct-1996 174.8
29-Nov-1996 179.3
30-Dec-1996 190.4
31-Jan-1997 185.7
This example was originally put on when-to-Convert-Dates-from-excel-files
Thank you for the reply!
Imagine, no need to thank. We’re here for this very.
Browser other questions tagged matlab
You are not signed in. Login or sign up in order to post.
Hello! welcome to Sopt. To import an excel file you can use the function
xlsread
.– Omni