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 CenterFile Exchange에서 Programming에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by