Function: ClrB
- 更新时间2023-02-21
- 阅读时长3分钟
Function: ClrB
Deletes a specific bit from the binary display of a decimal number. The ClrB function converts a decimal number to a binary number, deletes the specified bit, and reconverts the new binary number to a decimal number.
ReturnValue =Clr B(Value, BitIndex)
Input Parameters
| Value | Specifies a numeric value, a variable, or a data channel. |
| BitIndex |
Specifies a numeric value, a variable, or a data channel for the index of the bit you want to delete. Value range 0 to 31 |
|
| Note If you enter numbers with decimal places for the values Value and Index, DIAdem rounds the numbers to integers. |
Return Parameters
| ReturnValue | Returns integer values. If the specified bit already has the value 0, its value remains 0. If the input value is NoValue, the ClrB function returns the value NoValue. |
Examples
The following example deletes the second bit of the binary display of the decimal number 10.
| VBScript | Python |
Dim intMyResult intMyResult = ClrB(10,1) 'intMyResult = 8
The following example deletes the bits indexed by the Group1/Reference data channel from the values in the Group1/Input data channel, and saves the new decimal numbers in the new data channel Group2/Result. DIAdem skips values of the Group1/Reference index channel that are higher than 31.
| VBScript | Python |
Call Calculate ("Ch(""Group2/Result"")= ClrB (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: GetB | Function: NotB | Function: OrB | Function: SetB | Function: ShL | Function: ShR | Function: XOrB | Variable: ApplicationLegacyBinaryOperations
