Function: XOrB
- 更新时间2023-02-21
- 阅读时长3分钟
Function: XOrB
Determines the number resulting from the unequal bits of two numbers. The XOrB function converts the decimal numbers into binary numbers, determines the bits that the two numbers do not have in common, and reconverts this binary number into a decimal number.
ReturnValue = XOrB(Value1, Value2)
Input Parameters
| Value1 | Specifies a numeric value, a variable, or a data channel. |
| Value2 | Specifies a numeric value, a variable, or a data channel. |
| Note If you specify numbers with decimal places for the parameters Value1 and Value2, DIAdem rounds the numbers to integers. |
Return Parameters
| ReturnValue | Returns integer values. If the input value is NoValue, the XOrB function returns the value NoValue. |
Examples
The following example determines the unequal bits of the decimal numbers 10 (dual: 1010) and 12 (dual: 1100).
| VBScript | Python |
Dim intMyResult intMyResult = XOrB(10,12) 'intMyResult = 6 (dual:0110)
The following example determines the unequal bits of the values in each line of two data channels, and saves the decimal numbers in the new data channel Group2/Result.
| VBScript | Python |
Call Calculate ("Ch(""Group2/Result"")= XOrB (Ch(""Group1/Input""),Ch(""Group1/Reference""))")
| Note You must use the Calculate command in scripts to calculate data channels with formulas. Compute the data channels according to the syntax in the Calculator. Refer to the procedures Executing Channel Calculations in the Calculator and Assigning a Value to a Variable in the Calculator for more information about the Calculator. |
| Note You can also determine the unequal bits of two numbers with the VBS function XOr. |
![]() |
The first and the second physical quantity must be the same. The physical input quantities and the result quantities are the same. The Input and Result Quantities for Quantity-Based Calculations page contains an overview of the input quantities and result quantities of all functions. Refer to the Help page Calculating Quantity-Based and Non-Quantity-Based in DIAdem for the conditions and rules for quantity-based calculations. |
Related Functions
Function: AndB | Function: ClrB | Function: GetB | Function: NotB | Function: OrB | Function: SetB | Function: ShL | Function: ShR | Variable: ApplicationLegacyBinaryOperations
