Ismembertol command calculating average between two matched rows
显示 更早的评论
Hi everyone! I have a doubt about the ismembertol command, I'm trying to compare two matrices using this command.
A = [2.5 4.4 ; 3.6 8.9];
B = [2.8 4.6 3 ; 4.9 7.1 5 ; 3.5 8.7 2 ; 3.4 8.8 6 ; 4.9 12.5 4];
[ia,ib] = ismembertol(A,B(:,1:2), 0.2, 'ByRows',true);
a = [A(ia,:) B(ia,3)]
I'd like to obtain 3.6 8.9 4 as a result (4 is the average between the third column of the of the third and fourth rows of B) because there are two rows that match, but it returns:
a =
2.5000 4.4000 3.0000
3.6000 8.9000 5.0000
Thank you!
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Set Operations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!