How to align multiple datasets but data are not totally identical
18 views (last 30 days)
Show older comments
Hi, I'm new to Matlab and I have some questions regarding data alignment. I've seen similar questions already, like this one:
https://es.mathworks.com/matlabcentral/answers/429858-how-to-align-multiple-datasets
So in my case I also want to align two datasets but values are not totally similar, so I would like to know if there is a script that allows me to align datasets but adding some relative deviation. For example, I want to align values of 13.0 with values ranging from 12.5 to 13.5 (13.0+-0.5). Is this possible?
Thank you very much in advance
2 Comments
Image Analyst
on 16 May 2022
What form are your data in? Like a set of (x,y,z) point coordinates? Did you try a web search for "point set matching"
Answers (1)
Abhijit Bhattacharjee
on 19 May 2022
Without seeing a bit more detailed of an example, it's not easy to recommend the best path forward. But you could consider creating a copy of your data with rounded or binned values that you use for alignment, and then use the aligned indices to recover the original data of the alignment.
Here's a quick example:
% create example arrays to be aligned
idx1 = [1 2 3.05 3.95 5]';
idx2 = [2 3.01 4.03]';
A = array2table([idx1, randn(size(idx1))])
B = array2table([idx2, randn(size(idx2))])
% round the arrays
idx1_rounded = round(idx1);
idx2_rounded = round(idx2);
A_rounded = A;
A_rounded.Var1 = idx1_rounded
B_rounded = B;
B_rounded.Var1 = idx2_rounded
% align the arrays
result = outerjoin(A_rounded, B_rounded, 'Keys', [1,1])
0 Comments
See Also
Categories
Find more on Logical 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!