Can you synchronize two or more timetables if each timetable has a different number of rows and columns?
14 ビュー (過去 30 日間)
古いコメントを表示
I have 8 csv files with different types of sensor data. 5 of the files have 3 columns (variables) and 3 of the files have 14 columns. The one column that all the files share is UTC Time. Each file has a different number of rows. Is it possible to use timetables and synchronize to create a single table sorted by time that would then be written to a new csv file? What other MATLAB commands/features might be helpful here? Thank you-
1 件のコメント
dpb
2023 年 10 月 3 日
The description of synchronize says it "collects the variables from all input timetables, synchronizes them to a common time vector, and returns the result as a single timetable. ... In effect, synchronize horizontally concatenates the variables of [the input timetables] even when they have row times that differ. As a result, synchronize inserts a missing data indicator in [the output timetable wherever there are missing data from one table at an input time]. If [input timetables] have variables with the same names, then synchronize renames them and copies [all] variables into [the output timetable]."
If that's what you want to happen, then "yes".
Otherwise, you may want to look at the various join functions.
採用された回答
SAI SRUJAN
2023 年 10 月 9 日
Hi Nina Sweeney,
I can understand that you want to synchronize two or more timetables using MATLAB commands/features.
You can follow the below given example.
Suppose there are two timetables that have different rows and columns. "timetable1" consists of 3 rows and 1 column, while "timetable2" has dimensions of 4 rows and 2 columns. If we combine the two timetable arrays using "synchronize",the resulting timetable will encompass six rows and three variables.
dt1 = datetime('today')+(-1:1).'; % 3x1 datetime array
dt2 = datetime('today')+(-1:2).'+ 2; % 4x1 datetime array
timetable1=timetable(dt1,[1;2;3]); % 3x1 timetable
timetable2=timetable(dt2,[4;5;6;7],[8;9;10;11]); % 4x2 timetable
TT1=synchronize(timetable1,timetable2) % 6x3 timetable
You can refer to the similar community questions for your reference.
You can refer to the below documentation to understand more about "synchronize" function in MATLAB.
0 件のコメント
その他の回答 (1 件)
参考
カテゴリ
Help Center および File Exchange で Data Type Identification についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!