Combining duplicate data point in a data array wile keeping corresponding data
Show older comments
Hello,
I have two vectors x and y with corresponding data points. x is time data points, but may have double entries, e.g.
In fact, at the same time I am receiving several data point in spatial space (3D) (xyz direction). I want to merge identical data points for time while keeping the coressponding data points on y. For example, I wanna merge two 18 in one cell and then correspond (11.92771 -2.64893 -39.8758) and (4.938995 -9.26646 -24.8211) to 18. Should I use the unique function and then put them in struct?
t = x = [18, 18, 122, 283, 307, 346, 419, 436, 436, 436, 515, 553, 553, 557];
y = [ 11.92771 -2.64893 -39.8758,
4.938995 -9.26646 -24.8211
6.862585 1.986973 -17.4796
76.52667 31.68333 -70.2106
141.1145 42.40272 -194.467
-0.35181 -0.37868 1.738887
-3.98857 0.316846 -0.92413
-0.28841 1.157895 -1.70336
-1.7942 -0.98816 0.185217
6.728915 2.72758 -3.08762
-1.83741 -0.87261 0.316796
4.303505 4.844078 -16.5678
75.49939 -18.8806 -80.9268
11.6088 9.274039 -19.3556 ];
I want to merge identical data points for time while keeping the coressponding data points on y. For example, I wanna merge two 18 in one cell and then correspond (11.92771 -2.64893 -39.8758) and (4.938995 -9.26646 -24.8211) to 18. Should I use the unique function and then put them in struct?
Thanks in advance!
Accepted Answer
More Answers (0)
Categories
Find more on Image Arithmetic in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!