Why does a Boolean XOR block become a bitwise operation in generated C code?
11 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
MathWorks Support Team
am 9 Apr. 2020
Bearbeitet: MathWorks Support Team
am 14 Okt. 2021
When I generate code from a Boolean XOR block, it becomes a bitwise operation in the generated C code. Why is this the case, and are there any workarounds?
Akzeptierte Antwort
MathWorks Support Team
am 18 Okt. 2024
Bearbeitet: MathWorks Support Team
am 14 Okt. 2021
The "^" operator that is produced as generated code for the Logical XOR block is expected behavior since there is no true Boolean XOR operator in C.
If you wish to generate the relation operator "!=" instead, in the place of the Logical Operator XOR block you can use the Relational Operator block and select "~=".
0 Kommentare
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!