MATLAB: How can i convert from table to time table

time

Hi
Please, am new to matlab.
I would like to convert an imported table to time table but i'm having difficulties.
T = table2timetable(T)
Error using table2timetable (line 58)
Input table must contain datetime or duration vector for row times.
Attached is a picture of the data.
Thanks

Best Answer

Your sampTime variable looks like it contains the times stored as text data, not as a datetime array. Create a variable (either inside your table or as an independent variable) that stores the dates as a datetime array (pass the text into datetime) then call table2timetable. If you created the datetime variable in the table itself, table2timetable will use that for the RowTimes. If not you will need to pass the datetime array in as well.