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.
我需要将 6 和 7 的二进制表示组合在一起:
bin1 = fliplr(de2bi(6)); bin2 = fliplr(de2bi(7)); bin1 = 1 1 0 bin2 = 1 1 1
组合后的数字应该是
bin3 = 110111
有谁知道如何做到这一点?
如建议的那样,您可以将它们连接起来
bin3 = [bin1, bin2]
但是,如果您真的希望它们不带空格地打包在一起,您可以这样做:
bin3 = num2str([bin1, bin2]); bin3 = bin3(bin3 ~= ' ')
如果你现在想把它们变成一个数字,你可以使用str2num()
str2num()