false

Array of logical false values.

Category: Language Fundamentals > Matrices and Arrays

Syntax

F = false

Scalar false.

F = false(n)

n-by-n array of false.

F = false(m, n, ...)

Array of the given size.

F = false(sz)

Size given as a vector.

Description

false is both a constant and an array constructor. A logical array uses one byte per element, much less than a double mask, and works directly as an index. A typical pattern is to start from false(size(x)) and set the positions you want to select to true.

The companion true does the same with ones.

Input arguments

n, m, ...
Dimension sizes. Zero gives an empty array.

Output arguments

F
Logical array filled with 0.

Example

m = false(2, 3);
m(1, 2) = true;
m
class(m)
Output
m = 2×3 logical array

   0   1   0
   0   0   0
ans = 'logical'

See also

true zeros logical ones