MATLAB is a programming language and computing environment designed for working with matrices, vectors, and numeric data. The name comes from MATrix LABoratory, and that focus shows up everywhere: most values are arrays, and most operations are expressed as high-level array math.
In practice, when people say “MATLAB”, they may mean a few different things:
- The language: the
.msyntax and its semantics (arrays, indexing rules, functions, classes, errors). - The standard library: thousands of built-in functions (math, statistics, signal processing, images, optimization, etc.).
- Toolboxes: optional domain packages distributed by MathWorks (and sometimes third parties).
- The IDE and workflow: editor, debugger, workspace browser, plotting tools, and interactive REPL-like experience.
This FAQ explains MATLAB at a language/concept level, then explains how RunMat relates to it.
Why MATLAB is popular
MATLAB has stayed widely used in engineering and research because it makes a few things unusually easy:
- Array-first programming: express computations at the level of matrices/vectors instead of manual loops.
- Fast iteration: interactive exploration, quick plots, and a tight “edit → run → inspect” loop.
- Numerics and linear algebra: first-class support for matrix operations, decompositions, solvers, and signal/image workflows.
- Readable math: code often resembles the equations you’d write on a whiteboard.
Even when teams eventually move production systems to other languages, MATLAB often remains the fastest way to prototype and validate the math.
The MATLAB mental model (language basics)
Arrays are the default
In MATLAB, scalars are 1×1 arrays, vectors are 1-D arrays, and matrices are 2-D arrays. Many operations are defined in terms of array algebra.
Matrix vs element-wise operations
MATLAB distinguishes matrix operations from element-wise operations:
A * Bis matrix multiplication.A .* Bis element-wise multiplication.A ^ 2is matrix power (when defined).A .^ 2is element-wise power.
This is one of the most important “MATLAB-isms” to internalize.
1-based indexing and slicing
MATLAB indexes from 1, not 0:
A(1,1)is the first element.A(:, 3)means “all rows, column 3”.A(2:10)means elements 2 through 10.endcan appear in indexing and means “the last index in this dimension”.
Scripts and functions live in .m files
- A script is a sequence of statements executed in order.
- A function introduces its own scope and can return multiple outputs.
Control flow exists, but vectorization is idiomatic
Loops and if statements exist and are heavily used, but MATLAB style often prefers operations that work on whole arrays at once.
MATLAB vs Octave vs “MATLAB-like”
- MATLAB (MathWorks) is proprietary software with a large integrated library/toolbox ecosystem.
- GNU Octave is an open-source environment that aims for MATLAB compatibility, but it differs in many corners (especially around some newer language features and library/toolbox behavior).
- Many systems claim “MATLAB-like syntax”, but may differ significantly in semantics (especially indexing rules, type behavior, and edge cases).
If you care about correctness of existing MATLAB code, language semantics matter as much as surface syntax.
Where RunMat fits
RunMat is a high-performance, open-source runtime for MATLAB code.
It’s helpful to separate what MATLAB “is” into parts:
- Language: grammar + semantics
- Library/toolboxes: breadth of functions
- IDE: editor/debugger/workflow
RunMat’s strategy (by design) is:
- Implement MATLAB grammar and core semantics in the runtime.
- Ship a smaller core standard library, with a clear path to grow coverage.
- Treat “toolbox breadth” as packages (rather than baking everything into the core).
- Focus on performance and portability, especially for array-heavy numeric workloads.
As an open source project, RunMat’s framing is discussed explicitly in Design Philosophy.
MATLAB compatibility in RunMat
RunMat’s goal is to run MATLAB code with principled semantics parity, not just “similar syntax”.
What’s already strongly covered:
- Core language constructs: control flow, functions, closures, errors/exceptions.
- MATLAB-style indexing and slicing: including
endarithmetic and logical masks. - Many “hard” language features:
classdefOOP, operator overloading, imports/name resolution.
For a detailed feature-by-feature status, see Language Coverage.
What to expect in practice:
- Many
.mscripts run with few or no changes. - If a specific builtin/toolbox function isn’t present yet, that’s a library coverage gap (not necessarily a language gap).
- RunMat prefers documented behavior and stable error identifiers over copying historical quirks.
Performance: why RunMat exists
RunMat is built around the idea that you shouldn’t have to rewrite MATLAB-style math to get modern performance.
Automatic CPU + GPU choice (Fusion)
RunMat can capture chains of array operations, fuse them into larger kernels, and then route execution to CPU or GPU based on cost heuristics (size/shape/transfer cost). This is how RunMat targets “GPU speed without GPU programming.”
Key properties about RunMat Fusion:
- No device flags for typical code paths: the runtime chooses CPU vs GPU automatically.
- Cross-platform GPU backend via
wgpu, targeting Metal (macOS), DirectX 12 (Windows), Vulkan (Linux). - Residency awareness: keep arrays on device when it’s faster, and avoid unnecessary transfers.
To read more about RunMat Fusion, see Introduction to RunMat GPU/Fusion.
Tiered CPU execution (fast startup + fast hot loops)
RunMat also invests heavily in the CPU story:
- A fast-start interpreter tier (Ignition).
- A JIT compiler tier (Turbine/Cranelift) for hot paths.
- A generational garbage collector (GC) tuned for numeric workloads.
Quick start: try RunMat on MATLAB-style code
RunMat is CLI-first. Common entry points:
# Start an interactive REPL
runmat
# Run a .m file
runmat my_script.m
# Benchmark a script
runmat benchmark my_script.m --iterations 5 --jit
# Inspect acceleration provider / GPU status
runmat accel-info
For the full CLI reference, see CLI.
What RunMat is (and is not)
- RunMat is: a modern runtime that executes MATLAB code, with a strong focus on performance (CPU + GPU) and a clean extension story.
- RunMat is not: “MATLAB-in-full” bundled into one proprietary distribution; toolbox breadth is intended to grow via packages over time.
If you’d like to learn more about RunMat, please visit Runmat.org, or read the following articles:
- Language compatibility: Language Coverage
- Why the project is structured this way: Design Philosophy
- How GPU acceleration works: Introduction to RunMat GPU/Fusion
- How to run/benchmark/configure RunMat: CLI
- Toolboxes-as-packages direction: Package Manager (design)
Trademark notice
MATLAB® is a registered trademark of The MathWorks, Inc. RunMat is not affiliated with, endorsed by, or sponsored by The MathWorks, Inc.
Enjoyed this post? Join the newsletter
Monthly updates on RunMat, Rust internals, and performance tips.