table2timetable adding time vector with start- and end date
4 ビュー (過去 30 日間)
古いコメントを表示
From the recording software I"m using, I can export my data only using minutes from a reference point but I would like to convert my data to a timetable.
I know the start date and time and end date and time and tried to create a timetable based on that information:
newTimes = [datetime('2018-07-04 21:40:42'):datetime('2018-07-17 10:02:10')];
TT = table2timetable(tblB,'rowTime',newTimes)
The data was recorded in between this time range in a approx. 5 ms interval resutling in approx. 220000000 data points. Can I interpolate all the datetime/ from start and end time somehow assuming that the data was recorded regularly?
0 件のコメント
採用された回答
Steven Lord
2020 年 10 月 25 日
The times for a timetable can be either a datetime array or a duration array. Turn your data into a duration array and use it to build the timetable.
v = (1:5:101).';
data = v.^2;
timevector = seconds(v);
A = timetable(timevector, data)
0 件のコメント
その他の回答 (1 件)
Peter Perkins
2020 年 11 月 18 日
I'm not exactly sure what question you are asking. You can make a timetasble whose row times are durations (elapsed times), but it sounds to me like that's not what you want.
With that many rows, if you want row times that are datetimes, do something like this:
>> x = rand(220,1);
>> t0 = datetime('2018-07-04 21:40:42','Format','dd-MMM-uuuu HH:mm:ss.SSS');
>> tt = timetable(x,'StartTime',t0,'TimeStep',milliseconds(5))
tt =
220×1 timetable
Time x
________________________ _________
04-Jul-2018 21:40:42.000 0.81472
04-Jul-2018 21:40:42.005 0.90579
04-Jul-2018 21:40:42.010 0.12699
04-Jul-2018 21:40:42.015 0.91338
04-Jul-2018 21:40:42.020 0.63236
04-Jul-2018 21:40:42.025 0.09754
[snip]
This
newTimes = [datetime('2018-07-04 21:40:42'):datetime('2018-07-17 10:02:10')];
just needed a milliseconds(5) in the middle. As it was, the step was 24 hours.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Data Type Conversion についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!