Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我们如何对具有二进制值的两个不同大小的向量执行元素明智的逻辑或运算?
这是一个仅使用核心 MATLAB 函数的解决方案(即dec2bin和bin2dec):
dec2bin
bin2dec
a = 3; b = 5; bits = dec2bin(a,8)-'0' | dec2bin(b,8)-'0'; c = bin2dec(char(bits+'0'));
正如预期c的那样7
c
7