Comparing 2 column vectors?

3 visualizaciones (últimos 30 días)
Jon Snow
Jon Snow el 16 de Mayo de 2014
Comentada: Jon Snow el 16 de Mayo de 2014
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

Respuesta aceptada

Azzi Abdelmalek
Azzi Abdelmalek el 16 de Mayo de 2014
a = [0,0,1]
b = [0,1,0]
out=mean(a~=b)
  2 comentarios
Jon Snow
Jon Snow el 16 de Mayo de 2014
Can you please explain what that does? IT gets the average of "a not equal to b"?
Jon Snow
Jon Snow el 16 de Mayo de 2014
got it. thank you

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Matrix Indexing en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by