How to align multiple datasets but data are not totally identical
17 次查看(过去 30 天)
显示 更早的评论
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 个评论
Image Analyst
2022-5-16
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"
回答(1 个)
Abhijit Bhattacharjee
2022-5-19
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!