MATLAB Answers

compare two vectors/compare coordinates

15 ビュー (過去 30 日間)
Ilya
Ilya 2014 年 3 月 24 日
コメント済み: Ilya 2014 年 3 月 24 日
Hello,
lets assume I have one point with coordinates X1Y1=[1 1] and another point X2Y2=[1 1]. What is the shortest and possibly fastest way to compare them for equality/inequality (i.e. to compare if the two 2D points are equal)?
More general, I have two vectors a=[1 2 3 4 5 6 7] and b=[1 2 3 4 5 6 8]. How to compare the vectors of arbitrarily large length for equality in a fast an short way?
Is there any special function for this or they use something like
if sum(a-b)==0

採用された回答

Mischa Kim
Mischa Kim 2014 年 3 月 24 日
Ilya, use isequal(a,b).
  1 件のコメント
Ilya
Ilya 2014 年 3 月 24 日
Wow, thanks!!

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by