how can we perform element wise Logical OR operation on two vectors of different size having binary values?
Here is a solution using functions from core MATLAB only (namely dec2bin
and bin2dec
):
a = 3;
b = 5;
bits = dec2bin(a,8)-'0' | dec2bin(b,8)-'0';
c = bin2dec(char(bits+'0'));
where c
will be 7
as expected