RunMat
  • Pricing
RunMat
GitHub
GitHub
Sign inTry in browser
DesktopRuntimePhysicsCADAdministrationAgent

Get RunMat updates

New releases, guides and examples.

Product+
  • Runtime
  • GPU
  • Parallel
  • Compile
  • Interop and MEX
  • Simulation
  • MCAD
  • ECAD
  • Enterprise
  • AI integrations
  • Pricing
  • Download
Math+
  • Signal processing
  • Linear algebra
  • Statistics
  • Curve fitting
  • Differential equations
  • Control systems
  • Optimization
  • Finance
  • Data and tables
  • Plotting
Physics+
  • Simulation overview
  • Structural
  • Thermal
  • Electromagnetic
  • Joule heating
  • Thermal stress
  • Acoustics
  • Fluid flow
  • Conjugate heat transfer
  • Fluid–structure
  • What is FEA
Industries+
  • Aerospace
  • Automotive and transportation
  • Defense
  • Electronics and semiconductors
  • Energy
  • Industrial machinery
  • Life sciences
  • Quantitative finance
Learn+
  • Guides
  • Docs
  • Function reference
  • Language reference
  • Migration guide
  • Changelog
  • MATLAB Online
  • MATLAB AI agent
  • For students
Compare+
  • RunMat vs MATLAB
  • RunMat vs Ansys
  • RunMat vs SOLIDWORKS
  • RunMat vs Altium
  • RunMat vs Cadence
  • RunMat vs COMSOL
  • RunMat vs Python
  • RunMat vs Julia
  • RunMat vs Physics AI
  • RunMat vs Octave
  • Benchmarks
  • MATLAB alternatives
  • All comparisons
Company+
  • About
  • Blog
  • Contact
  • Source code↗
  • License
  • Privacy
  • Terms

Product

  • Runtime
  • GPU
  • Parallel
  • Compile
  • Interop and MEX
  • Simulation
  • MCAD
  • ECAD
  • Enterprise
  • AI integrations
  • Pricing
  • Download

Math

  • Signal processing
  • Linear algebra
  • Statistics
  • Curve fitting
  • Differential equations
  • Control systems
  • Optimization
  • Finance
  • Data and tables
  • Plotting

Physics

  • Simulation overview
  • Structural
  • Thermal
  • Electromagnetic
  • Joule heating
  • Thermal stress
  • Acoustics
  • Fluid flow
  • Conjugate heat transfer
  • Fluid–structure
  • What is FEA

Industries

  • Aerospace
  • Automotive and transportation
  • Defense
  • Electronics and semiconductors
  • Energy
  • Industrial machinery
  • Life sciences
  • Quantitative finance

Learn

  • Guides
  • Docs
  • Function reference
  • Language reference
  • Migration guide
  • Changelog
  • MATLAB Online
  • MATLAB AI agent
  • For students

Compare

  • RunMat vs MATLAB
  • RunMat vs Ansys
  • RunMat vs SOLIDWORKS
  • RunMat vs Altium
  • RunMat vs Cadence
  • RunMat vs COMSOL
  • RunMat vs Python
  • RunMat vs Julia
  • RunMat vs Physics AI
  • RunMat vs Octave
  • Benchmarks
  • MATLAB alternatives
  • All comparisons

Company

  • About
  • Blog
  • Contact
  • Source code↗
  • License
  • Privacy
  • Terms
GitHubXLinkedIn

© Dystr, Inc. · RunMat v0.7.1, Nov 17, 2026

RunMat® is a registered trademark of Dystr, Inc. MATLAB® is a registered trademark of The MathWorks, Inc. RunMat is not affiliated with, endorsed by, or sponsored by The MathWorks, Inc.

/
See all docs
Builtin Reference
    • and
    • not
    • or
    • xor

or — Compute element-wise logical disjunction.

or(A,B) and A | B return true where either corresponding operand is nonzero.

Syntax

tf = or(A, B)

Inputs

A
Type
Any
Required
Yes
Description
Logical, real numeric, table, timetable, or supported extension operand.
B
Type
Any
Required
Yes
Description
Logical, real numeric, table, timetable, or supported extension operand.
NameTypeRequiredDefaultDescription
AAnyYes—Logical, real numeric, table, timetable, or supported extension operand.
BAnyYes—Logical, real numeric, table, timetable, or supported extension operand.

Returns

tf
Type
Any
Description
Logical result with the expanded array shape or the input tabular container.
NameTypeDescription
tfAnyLogical result with the expanded array shape or the input tabular container.

Errors

RunMat:or:InvalidInput
When
An operand is not supported logical, numeric, character, complex, table, timetable, or resident numeric data.
Message
or: unsupported input type
RunMat:or:SizeMismatch
When
Operand shapes are not compatible for implicit expansion, or tabular operands cannot be aligned.
Message
or: input sizes are not compatible
IdentifierWhenMessage
RunMat:or:InvalidInputAn operand is not supported logical, numeric, character, complex, table, timetable, or resident numeric data.or: unsupported input type
RunMat:or:SizeMismatchOperand shapes are not compatible for implicit expansion, or tabular operands cannot be aligned.or: input sizes are not compatible

Truth and shape semantics

or(A,B) converts corresponding elements to zero/nonzero truth values after compatible-size expansion, then returns true where either value is true. Zero is false; every nonzero real value, including NaN, is true. The result is logical and has the expanded shape.

All eight fixed-width integer classes are tested directly in their authoritative storage. Empty shapes propagate without adding elements.

Tables and accelerated execution

For tables and timetables, or operates on corresponding variables. Variable names, row names, and row times may appear in a different order; RunMat aligns them to the first input before evaluation and retains that input's container metadata.

A supported operation on inputs owned by the same provider remains resident. Unsupported provider routes gather exact values; explicitly requested residency is restored only after validating owner, device, shape, storage, and aliasing.

Complex and character operands are available in RunMat mode. The compatibility pin accepts the documented real numeric, logical, table, and timetable forms.

Examples

Combine scalar conditions

tf = or(true, false)

Expected output:

tf = true

Combine numeric arrays

A = [1 0 2 0];
B = [3 4 0 0];
tf = or(A, B)

Expected output:

tf = [true true true false]

Expand a row across a column

tf = or([1; 0], [0 2 0])

Expected output:

tf = [true true true; false true false]

Treat NaN as nonzero

tf = or(NaN, 0)

Expected output:

tf = true

Apply disjunction to table variables

T = table([0; 2], [1; 0], 'VariableNames', {'A', 'B'});
R = or(T, 0)

Expected output:

R is a table with logical variables

Use complex truth values in RunMat mode

tf = or([0+0i 1+0i], 0+2i)

Expected output:

tf = [true true]

Keep a supported result resident

A = gpuArray([0 2 0]);
B = gpuArray([1 0 0]);
G = or(A, B);
tf = gather(G)

Expected output:

G remains resident and tf = [true true false]

Using or with coding agents

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

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

FAQ

What does or return?⌄

Scalar operands produce a logical scalar; array operands produce logical arrays; tabular operands retain their table or timetable container with logical variables.

How is NaN interpreted?⌄

NaN is nonzero and therefore true before the logical operation is applied.

Does implicit expansion apply?⌄

Yes. Singleton dimensions expand against compatible dimensions; incompatible array shapes report a size error.

Are integers converted to double?⌄

No. Integer zero/nonzero truth is read directly from each fixed-width class.

How are tables handled?⌄

The operation is applied variable by variable after aligning compatible tabular metadata. The result retains the first tabular input's class and metadata.

Can execution remain on a GPU?⌄

Yes when an exact owning provider supports the operation. Exact fallback preserves explicit gpuArray intent after validating the restored result.

Related Logical functions

Bit

and · not · xor

Tests

allfinite · iscell · iscellstr · isfinite · isgpuarray · isinf · islogical · isnan · isnumeric · isreal · issparse · isstruct

Rel

eq · ge · gt · isequal · isequaln · le · lt · ne

Logical

logical

Source you can read

Every RunMat function's source is public. Read exactly how or is executed, line by line, in Rust.

  • View the source for or in Rust on GitHub
  • Learn how the RunMat runtime works
  • Found a bug? Open an issue with a minimal reproduction.

About RunMat

RunMat is a runtime that executes MATLAB-syntax code fast on any GPU. The runtime is free for individuals, including freelancers; students and faculty at an academic institution, for teaching or research there; contributors to an open-source project, for work on that project; organizations with 250 or fewer people and US$10M or less in annual revenue; and anyone, for non-production use. See runmat.com/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.

Download RunMatOpen Sandbox
On this page
  • Syntax
  • Inputs
  • Returns
  • Errors
  • Truth and shape semantics
  • Tables and accelerated execution
  • Examples
  • Combine scalar conditions
  • Combine numeric arrays
  • Expand a row across a column
  • Treat NaN as nonzero
  • Apply disjunction to table variables
  • Use complex truth values in RunMat mode
  • Keep a supported result resident
  • Using or with coding agents
  • FAQ
  • Related Logical functions
  • Bit
  • Tests
  • Rel
  • Logical
  • Source you can read
  • About RunMat