read time in HH:mm format from excel

9 views (last 30 days)
I have to read a column from excel file named Time ,the data in that column is in HH:mm format i need to read it and save it and display it in same format

Answers (1)

Walter Roberson
Walter Roberson on 18 Aug 2023
filename = 'AppropriateFileName.xlsx';
opts = detectImportOptions(filename);
opts = setvaropts(opts, {'Time'}, 'Type', 'duration', 'InputFormat', 'hh:mm', 'DurationFormat', 'hh:mm');
T = readtable(filename, opts);

Tags

Community Treasure Hunt

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

Start Hunting!