DIAdem API Reference

Function: NotB

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

Negates the bits of the one-byte long binary representation of a decimal number. The NotB function converts the decimal numbers to one-byte long binary numbers, negates each bit, and reconverts the new binary number to a decimal number.

ReturnValue = NotB(Value,ByteLength)

Input Parameters

ValueSpecifies a numeric value, a variable, or a data channel.
ByteLength Specifies a numeric value, a variable, or a data channel for the byte length.
Value range 1 to 4
Note  If you enter numbers with decimal places for the parameters Value and ByteLength, DIAdem rounds the numbers to integers.
From DIAdem 2014, the function no longer calculates the sum of the ByteLength input parameter.

Return Parameters

ReturnValueReturns integer values. If the input value is NoValue, the NotB function returns the value NoValue. If the input parameter ByteLength is outside the value range, the function returns the value 0.

Examples

The following example negates the one-byte long binary representation of the decimal number 10.

VBScriptPython

 

Dim intMyResult
intMyResult = NotB(10,1)    'intMyResult = 245

The following example switches the bits of the values in the Group1/Input data channel within the byte length given by the Group1/Reference data channel and saves the result in the new data channel Group2/Result.

VBScriptPython

 

Call Calculate ("Ch(""Group2/Result"")= NotB (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.
The first physical input quantity is arbitrary. The second input quantity must be dimensionless. The first physical input quantity and the result quantity 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: OrB | Function: SetB | Function: ShL | Function: ShR | Function: XOrB | Variable: ApplicationLegacyBinaryOperations