Converting a table to a timetable
20 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hello there I have a table with time in seconds and acclerometer data in the x,y, and z directions. I am trying to convert my table into a time table to perforom analysis but I get an error saying "table2timetable Input table must contain datetime or duration vector for row times", Any suggestions on hiw to fix this or turn my "Time" variable in my table into a datetime or duration vector?
Thank you so much!
0 Commenti
Risposte (1)
Voss
il 15 Mar 2024
Here's an example:
% a table
T = table([1;2;3],[4;5;6],'VariableNames',{'Time','x'})
% Time column is not duration or datetime
class(T.Time)
% try to convert T into a timetable
try
T = table2timetable(T) % error
catch e
disp(sprintf('Error: %s',e.message))
end
% convert T.Time to durations in seconds
T.Time = seconds(T.Time)
% now Time is duration
class(T.Time)
% and T can be converted into a timetable
T = table2timetable(T)
1 Commento
Vedere anche
Categorie
Scopri di più su Data Type Conversion in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!