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.
试试这个
>> A = [1 2]; >> B = [1 4]; >> xor(A, B) ans = 0 0
如何?哪里错了?
您应该使用按位异或:
>> A = [1 2] >> B = [1 4] >> C = bitxor(A, B) >> C C = 0 6
我认为错误是,matlab 将所有内容 != 0 视为真实。正如我们所知
true xor true -> false.
也许matlab中的快速异或数组可以帮助你。