false — Create logical arrays filled with false values in MATLAB and RunMat.

false creates logical arrays filled with false values. Scalar, vector, matrix, and N-D sizing forms follow MATLAB semantics.

Syntax

L = false()
L = false(n)
L = false(size_vector)
L = false(m, n, ...)
L = false(prototype)
L = false(..., "logical")
L = false(..., "like", prototype)

Inputs

NameTypeRequiredDefaultDescription
nSizeArgYesSquare size.
size_vectorSizeArgYesSize vector defining output dimensions.
dimsSizeArgVariadicDimension sizes.
prototypeLikePrototypeYesPrototype value when no numeric dimension arguments are provided.
typenameStringScalarNo"logical"Class override keyword (logical).
like_kwStringScalarYes"like"Like keyword.
prototypeLikePrototypeYesPrototype array used for class/device.

Returns

NameTypeDescription
LLogicalArrayLogical output array.

Errors

IdentifierWhenMessage
The 'like' keyword is provided without a prototype argument.false: expected prototype after 'like'
The 'like' keyword is provided multiple times.false: multiple 'like' specifications are not supported
A trailing option string is not supported.false: unrecognised option
Dimension arguments fail numeric/shape parsing.false: dimension arguments must be numeric and nonnegative

How false works

  • false() returns the scalar logical false.
  • 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 as A.
  • 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

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     0

Creating 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     0

Using false with coding agents

Open a RunMat example with live inputs, then ask the agent to explain how false changes the result.

Run a small false example, explain the result, then change one input and compare the output.

FAQ

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.

Creation

colon · eye · fill · inf · linspace · logspace · magic · meshgrid · nan · ones · peaks · rand · randi · randn · randperm · range · true · zeros

Sorting Sets

argsort · intersect · ismember · issorted · setdiff · sort · sortrows · union · unique

Shape

cat · circshift · diag · flip · fliplr · flipud · horzcat · ipermute · kron · permute · repelem · repmat · reshape · rot90 · squeeze · tril · triu · vertcat

Indexing

find · ind2sub · sub2ind

Introspection

isempty · ismatrix · isscalar · isvector · length · ndims · numel · size

Open-source implementation

Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how false is executed, line by line, in Rust.

About RunMat

RunMat is an open-source runtime that executes MATLAB-syntax code blazing on any GPU. It is licensed under the Apache 2.0 license.

  • RunMat automatically optimizes your math for GPU execution on Apple, Nvidia, and AMD hardware. No code changes needed. Simulations that took hours now take minutes.
  • Start running code in seconds. RunMat runs in the browser, on the desktop, or from the CLI. No license server, no IT ticket.

Getting started · Benchmarks · Pricing

Download RunMat

Download RunMat for full performance, or use RunMat in your browser for zero setup.