count

12 ビュー (過去 30 日間)
mahaveer hanuman
mahaveer hanuman 2011 年 7 月 23 日
I have g(45x2)and I(45x2) i want to compare each and every row of g with I(45x2) and count them are equal
  2 件のコメント
Oleg Komarov
Oleg Komarov 2011 年 7 月 23 日
Do you want a row by row comparison?
Jan
Jan 2011 年 7 月 23 日
Do you want to compare the 1st with the 1st, the 2nd with the 2nd etc, or the 1st with the 2nd also?

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

採用された回答

Daniel Shub
Daniel Shub 2011 年 7 月 23 日
G = randi(3, 45, 2);
I = randi(3, 45, 2);
sum(all(G == I, 2))
  1 件のコメント
Image Analyst
Image Analyst 2011 年 7 月 27 日
If G and I are floating point arrays, you need to be aware of the FAQ http://matlab.wikia.com/wiki/FAQ#Why_is_0.3_-_0.2_-_0.1_.28or_similar.29_not_equal_to_zero.3F so that you check for tolerance rather than exact equality.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by