Synchronize sensor data from multiple sensors
Afficher commentaires plus anciens
I have sensor data from four inertial sensors. When collecting data the the .csv files for each sensor have a slightly different amount of rows as some measurements are missed. Now I want to synchronize the four dataframes into one big dataframe that contains the data from all four sensors and is synchronized.
The data looks something like this
Sensor 1 =
SampleTimeFine FreeAcc_X_S1
______________ __________
1 2.0
23 4.0
36 6.0
47 8.0
53 10.0
Sensor 2 =
SampleTimeFine FreeAcc_X_S2
______________ __________
1 3.0
36 5.0
47 6.0
53 2.0
Sensor 3 =
SampleTimeFine FreeAcc_X_S3
______________ __________
1 1.0
23 5.0
47 4.0
53 9.0
Sensor 4 =
SampleTimeFine FreeAcc_X_S4
______________ __________
1 6.0
23 5.0
36 6.0
47 7.0
53 8.0
I want to end up like this:
Sensor 1 =
SampleTimeFine FreeAcc_X_S1
______________ __________
1 2.0
23 4.0
36 6.0
47 8.0
53 10.0
Sensor 2 =
SampleTimeFine FreeAcc_X_S2
______________ __________
1 3.0
23 4.0
36 5.0
47 6.0
53 2.0
Sensor 3 =
SampleTimeFine FreeAcc_X_S3
______________ __________
1 1.0
23 5.0
36 4.5
47 4.0
53 9.0
Sensor 4 =
SampleTimeFine FreeAcc_X_S4
______________ __________
1 6.0
23 5.0
36 6.0
47 7.0
53 8.0
As you can see a new row is added in both table 2 and table 3. The FreeAcc_X is interpolated for these new rows. In the end I want to add these tables into one bigger table. It should look like this:
Sensor_all =
SampleTimeFine FreeAcc_X_S1 FreeAcc_X_S2 FreeAcc_X_S3 FreeAcc_X_S4
______________ __________ __________ __________ __________
1 2.0 3.0 1.0 6.0
23 4.0 4.0 5.0 5.0
36 6.0 5.0 4.5 6.0
47 8.0 6.0 4.0 7.0
53 10.0 2.0 9.0 8.0
What is an easy way to do this?
1 commentaire
The solution is similar to the solution I shared in your previous question but we didn't hear back from you on that thread. Instead of using innerjoin you'll use a similar function.
Réponse acceptée
Plus de réponses (1)
Mohammad Sami
le 20 Mai 2021
0 votes
The easiest way to do this is to import your data as timetables and then use the built in synchronize function. Details and examples are in the documentation.
https://www.mathworks.com/help/matlab/ref/timetable.synchronize.html
2 commentaires
Dylan den Hartog
le 20 Mai 2021
Mohammad Sami
le 22 Mai 2021
If a sample time fine value across different sensor is considered equal, you can use this as a time variable for this purpose.
Catégories
En savoir plus sur LaTeX dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!