Read excel file with Matlab
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Sanley Guerrier
el 18 de Ag. de 2023
Comentada: Star Strider
el 18 de Ag. de 2023
Hello,
I have excel file with three columns "Time", "Altitude, And "Shadow length" that I want to read in Matlab. I tried this commands below, however, the column "Time" format change to decimal number. What can I do to keep the time format the same?
Thank you!
T = readtable('Shadedata.xlsx');
opts = detectImportOptions('Shadedata.xlsx');
preview('Shadedata.xlsx',opts)
0 comentarios
Respuesta aceptada
Star Strider
el 18 de Ag. de 2023
One option is to use the datetime 'ConvertFrom' name-value pair. For the ‘value’ argument, both 'excel' and 'posixtime' work, with 'excel' appearing to be correct (in that it gives 15-minute intervals) —
% F = fileread('Shadedata.xlsx')
% C = readcell('Shadedata.xlsx')
T = readtable('Shadedata.xlsx', 'VAriableNamingRule','preserve')
T1 = T;
T1.Time = datetime(T1.Time, 'ConvertFrom','excel')
T2 = T;
T2.Time = datetime(T2.Time, 'ConvertFrom','posixtime')
Choose the result that makes the best sense.
.
6 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Dates and Time en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!