Import dates from an excel spreadsheet

2 ビュー (過去 30 日間)
Constantinos Constantinou
Constantinos Constantinou 2019 年 5 月 28 日
回答済み: Guillaume 2019 年 5 月 28 日
Hello,
I need to import the attached data from an excel spreadsheet into matlab.
Column E represents the temperature values and column F represents the time values.
When I import the time values in excel with the Import Tool the result is decimal numbers.
Other pots I have read about explain how to convert a single entry into the correct time value but my question is how do I convert the whole time column into the desired values in format HH:MM:SS.
Many thanks.

回答 (1 件)

Guillaume
Guillaume 2019 年 5 月 28 日
One way to read that data:
opts = detectImportOptions('temperature.xlsx'); %ask matlab to detect the format of the file
opts.VariableTypes{2} = 'duration'; %override format of Time to duraiton
opts = setvaropts(opts, 'Time', 'DurationFormat', 'hh:mm:ss') %display duration as hh:mm:ss
tt = readtimetable('temperature.xlsx', opts)
Excel must do some rounding on the time that matlab doesn't do as some times are off by one second

カテゴリ

Help Center および File ExchangeSpreadsheets についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by