MATLAB: How to use textscan to import time value (hh:mm:ss)

hh:mm:ssimport timetextscan

I need to import time values in a given column to an array using textscan. I can't seem to be able to find the correct format spec to do this.
Attached is the file I am trying to import from. The row titled 'Start Time" is what I want. The values begin in row 22 column 2 and are in format (hh:mm:ss).
The import data tool uses the below format however gives me rounded values numerical values that are not helpful. How can I edit this to give me what I want
delimiter = ',';
if nargin<=2
startRow = 22;
endRow = 22;
end
formatSpec = '%*s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%[^\n\r]';
dataArray = textscan(fileID, formatSpec, endRow(1)-startRow(1)+1, 'Delimiter', delimiter, 'TextType', 'string', 'HeaderLines', startRow(1)-1, 'ReturnOnError', false, 'EndOfLine', '\r\n');

Best Answer

I think it's better to do it step-by-step, like:
% Read the file
fid = fopen('181018_PL.txt','r');
c = textscan(fid,'%s','Delimiter','\n');
fclose(fid);
% Extract the line starts with 'Start Time'
idx = startsWith(c{1},'Start Time');
str = c{1}{idx};
% Split the line and eliminate 'Start Time'
dataArray = strsplit(str,',');
dataArray(1) = [];
% Convert to datetime
dataArray = datetime(dataArray);