split timetables into multiple hourly timetables and save as separate .mat files
이전 댓글 표시
I have some timeseries sensor data that start at a random time and end at a random time (a sample shown below):
08/05/2019,16:24:37.988776000 0.464062500000000 4.68968700000000
08/05/2019,16:24:37.989776000 0.580312500000000 4.75656200000000
08/05/2019,17:24:37.990776000 0.679687500000000 3.00000000000000
08/05/2019,16:24:37.991776000 0.472500000000000 4.95500000000000
08/05/2019,18:24:37.992776000 0.670312500000000 4.75718800000000
I am trying to split the timetable into separate timetables for each hour of data. I've used the discretise function and created a bin column based on the hours each row of data corresponds to using the script:
test = load([dir_file,test_name,'.mat']);
ttab = test.test_timetable;
binned = discretize(ttab.Var1,'Hour');
tab_binned = table(ttab.Var1,ttab.X,binned);
tab_binned.Properties.VariableNames = {'var2','var1','binned'};
ttab_c_binned = [ttab,tab_binned(:,{'binned'})];
I could use for loops and split the time table and save separate time tables per hour but I wondered if there was a neater way of doing this?
Thanks!
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Timetables에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!