Skip to content

lognum

Numeric coercion of a logical value.

B = lognum(A)

Converts logical values to their numeric equivalents — true becomes 1, false becomes 0. Element-wise. Same effect as double(A) for logical inputs.

lognum([true false true]) % [1 0 1]
  • double — Convert to double-precision floating-point.
  • n — Convert a value to a number; non-numeric becomes 0.
  • islogical — Test whether the input is of logical (boolean) type.