how to do bitxor operation of two 1*255 matrix
3 次查看(过去 30 天)
显示 更早的评论
h1 =1x255 logical
h3 = 1x255 logical
howto do bitxor of h1 and h3
0 个评论
回答(2 个)
Greg
2018-11-30
编辑:Greg
2018-11-30
result = h1 | h3;
Edit: this is logical (bit) or, not xor. As posted elsewhere, simply use the xor function.
4 个评论
Jan
2018-11-30
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
2018-11-30
编辑:James Tursa
2018-11-30
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 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!