false — Create logical arrays filled with false values.
false creates logical arrays filled with false values. RunMat mirrors MATLAB sizing semantics across scalar, vector, matrix, and N-D forms.
How does the false function behave in MATLAB / RunMat?
false()returns the scalar logicalfalse.false(n)returns an n x n logical array of false values.false(m, n, ...)returns a logical array with the requested dimensions.false(sz)accepts a size vector (row or column) and returns an array with prod(sz) elements arranged using MATLAB column-major ordering.false(A)returns a logical array of false with the same size asA.false(___, 'like', prototype)uses the prototype only for sizing; the result is still a host logical array.false(___, 'logical')is accepted for MATLAB compatibility and has no effect.
Examples of using false in MATLAB / RunMat
Creating a 2x3 logical array of false values
mask = false(2, 3)Expected output:
mask = [0 0 0; 0 0 0]Creating a logical array from a size vector
dims = [1 4 2];
mask = false(dims)Expected output:
mask =
1x4x2 logical array
0 0 0 0
0 0 0 0Creating a false mask with the same size as an existing array
A = rand(2, 2);
mask = false(A)Expected output:
mask =
2x2 logical array
0 0
0 0FAQ
What does false() return?
It returns the logical scalar false.
Does false(n) create a square array?
Yes. false(n) returns an n x n logical array of false values, matching MATLAB behavior.
How does false(sz) interpret a size vector?
A row or column vector is treated as the full set of dimensions, so false([2 3 4]) yields a 2x3x4 logical array.
Does false keep results on the GPU?
No. The builtin always returns a host logical array. gpuArray inputs are only used to infer the output size.
Is the 'logical' option required?
No. false always returns logical values; the 'logical' option is accepted only for MATLAB compatibility.
See also
true, logical, islogical, zeros
Source & Feedback
- Source code: `crates/runmat-runtime/src/builtins/array/creation/true_false.rs`
- Found a bug? Open an issue with a minimal reproduction.