Two vectors different from each other at least at two points
1 次查看(过去 30 天)
显示 更早的评论
I want to compare two vectors and check whether they are different at least at two coordinates.
0 个评论
采纳的回答
jonas
2018-10-6
编辑:jonas
2018-10-6
sum(abs(V1-V2)~=0)>=2
Will output 1 if they differ at two or more indices. You may want to set a tolerance if they are floating point numbers.
tol=0.01
sum(abs(V1-V2)>tol)>=2
更多回答(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!