DIAdem API Reference

Function: OrB

  • 更新时间2023-02-21
  • 阅读时长3分钟

Calculates the number resulting from the shared bits of two numbers. The OrB function converts the decimal numbers into binary numbers, determines the shared bits, and reconverts this binary number into a decimal number.

ReturnValue = OrB(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

ReturnValueReturns integer values.  If the input value is NoValue, the OrB function returns the value NoValue.

Examples

The following example calculates the shared bits of the two decimal numbers 12 and 16 and saves the corresponding decimal number.

VBScriptPython

 

Dim intMyResult
intMyResult = OrB(16,12)    'intMyResult = 28

The following example calculates the shared bits of the values of two data channels rowwise and saves the decimal numbers in the data channel Group2/Result.

VBScriptPython

 

Call Calculate ("Ch(""Group2/Result"")= OrB (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 calculate the shared bits of two numbers with the VBS function Or.
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: SetB | Function: ShL | Function: ShR | Function: XOrB | Variable: ApplicationLegacyBinaryOperations