Comparing 2 column vectors?

3 次查看(过去 30 天)
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"?

请先登录,再进行评论。

更多回答(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