# how to do bitxor operation of two 1*255 matrix

2 visualizaciones (últimos 30 días)
moni sinha el 30 de Nov. de 2018
Editada: Greg el 30 de Nov. de 2018
h1 =1x255 logical
h3 = 1x255 logical
howto do bitxor of h1 and h3
##### 0 comentariosMostrar -2 comentarios más antiguosOcultar -2 comentarios más antiguos

Iniciar sesión para comentar.

### Respuestas (2)

Greg el 30 de Nov. de 2018
Editada: Greg el 30 de Nov. de 2018
result = h1 | h3;
Edit: this is logical (bit) or, not xor. As posted elsewhere, simply use the xor function.
##### 4 comentariosMostrar 2 comentarios más antiguosOcultar 2 comentarios más antiguos
Jan el 30 de Nov. de 2018
The error message is clear: The array sizes are different. Here the variables h1 (logical) and c (double) are concerned. So why do you ask for "h1 =1x255 logical, h3 = 1x255 logical"?
Greg el 30 de Nov. de 2018
Editada: Greg el 30 de Nov. de 2018
Good catch Guillaume, i kept reading or not xor.
Why are we assuming c is the second argument? The original post explicitly states h1 and h3, both are logical and same size. All following posts are new problems to the original question.

Iniciar sesión para comentar.

James Tursa el 30 de Nov. de 2018
Editada: James Tursa el 30 de Nov. de 2018
It's not entirely clear to me what operation you really want, but if the elements of h1 and h2 represent "bits", then you could just do this:
result = (h1 ~= h2); % equivalent of xor between the elements of h1 and h2
If h1 and h2 don't have the same number of elements, then that is a different problem that you will need to fix before doing the xor operation.
##### 2 comentariosMostrar NingunoOcultar Ninguno
Guillaume el 30 de Nov. de 2018
Or
result = xor(h1, h2);
Greg el 30 de Nov. de 2018
Guillaume's comment here should be a separate answer, and accepted.

Iniciar sesión para comentar.

### Categorías

Más información sobre Logical 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