Comparing 2 column vectors?

조회 수: 3 (최근 30일)
Jon Snow
Jon Snow 2014년 5월 16일
댓글: Jon Snow 2014년 5월 16일
Lets say I have 2 vectors: a = [0,0,1] b = [0,1,0]
Comparing a and b, there is a a difference in 2 digits (column 2 and column 3). Therefor error rate is 2/3.
Can you help me set up a code that compares each column in vector a and b and that prints an error. Perhaps, use a for/if loop?
Thank you

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2014년 5월 16일
a = [0,0,1]
b = [0,1,0]
out=mean(a~=b)
  댓글 수: 2
Jon Snow
Jon Snow 2014년 5월 16일
Can you please explain what that does? IT gets the average of "a not equal to b"?
Jon Snow
Jon Snow 2014년 5월 16일
got it. thank you

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by