how to do bitxor operation of two 1*255 matrix
Mostra commenti meno recenti
h1 =1x255 logical
h3 = 1x255 logical
howto do bitxor of h1 and h3
Risposte (2)
result = h1 | h3;
Edit: this is logical (bit) or, not xor. As posted elsewhere, simply use the xor function.
4 Commenti
moni sinha
il 30 Nov 2018
Guillaume
il 30 Nov 2018
Your screenshot clearly shows that h1 is 1x254, and c is 1x256. So yes, you're going to get an error telling you that their size do not match.
Note that |is the or operator, not the xor operator.
Jan
il 30 Nov 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"?
James Tursa
il 30 Nov 2018
Modificato: James Tursa
il 30 Nov 2018
0 voti
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.
Categorie
Scopri di più su Image Preview and Device Configuration in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!.png)
