RunMat
  • Pricing
RunMat
GitHub
GitHub
DownloadSign InTry in Browser
DesktopRuntimeServer
RunMat

Run math blazing fast

GitHubX (Twitter)LinkedIn

Company

  • About
  • Pricing
  • Contact

Explore

  • RunMat for academia
  • RunMat vs MATLAB Online
  • Benchmarks

Get product updates and release notes from the RunMat team.

© 2026 Dystr · Made withfor the scientific community.

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.

LicensePrivacy
/
See all docs
Builtin Reference
    • cell
    • cell2mat
    • cell2struct
    • cellfun
    • cellstr
    • iscell
    • iscellstr
    • mat2cell
    • num2cell

cell — Create preallocated cell arrays whose elements contain empty double arrays.

cell preallocates a host cell array of a requested size. Every cell created by a documented form contains a 0×0 double array. RunMat accepts exact size controls in all eight integer classes without converting them through binary64.

Syntax

C = cell()
C = cell(n)
C = cell(sz)
C = cell(m, n, ...)
C = cell("like", prototype)
C = cell(sz, "like", prototype)
C = cell(m, n, ..., "like", prototype)

Inputs

NameTypeRequiredDefaultDescription
nSizeArgYes—Square size.
szSizeArgYes—Size vector.
dimsSizeArgVariadic—Dimension sizes.
like_kwStringScalarYes"like"Like keyword.
prototypeLikePrototypeYes—Prototype value used to infer element class.

Returns

NameTypeDescription
CAnyOutput cell array.

Errors

IdentifierWhenMessage
RunMat:cell:InvalidInputInput arguments or option forms are invalid.cell: invalid input arguments
RunMat:cell:InvalidSizeRequested size arguments are invalid or unsupported.cell: invalid size arguments
—Internal cell allocation or conversion failed.cell: internal error

How cell works

  • RunMat accepts cell() as a nonconflicting shorthand for a 0×0 empty cell array; this form is not listed in the current public syntax and is not speculatively mode-gated from documentation silence.
  • cell(n) returns an n×n cell array of 0×0 double arrays.
  • cell(sz1, ..., szN) returns an N-D cell array with the requested dimensions and ignores trailing singleton dimensions after dimension two.
  • cell(sz) or cell(size(A)) accepts a row size vector. A one-element size input follows the square n×n form; a column size vector is not a documented input.
  • Size controls accept single, double, int8, int16, int32, int64, uint8, uint16, uint32, or uint64. Integer storage is decoded exactly, finite fractional values reject, and signed negative values are treated as zero.
  • The 'like' prototype selector and resident GPU size controls are separately registered RunMat extensions and reject in MATLAB-compatible mode.

Does RunMat run cell on the GPU?

Cell construction terminates GPU fusion because the heterogeneous container lives on the host heap. In RunMat extension mode, a resident size control is gathered from its owning provider without floating reinterpretation and the host cell array is allocated from the decoded dimensions. MATLAB-compatible mode rejects that extension before provider dispatch or gather.

GPU memory and residency

No. The result is always a host cell array. The public constructor does not document interactive gpuArray input; RunMat's named GPU-size extension can gather an exact resident size control before host allocation when extension mode is enabled.

Examples

Creating a square cell array of empty placeholders

C = cell(3);
size(C)

Expected output:

ans =
     3     3

Creating a rectangular 2-by-4 cell array

C = cell(2, 4);
class(C)

Expected output:

ans =
    'cell'

Creating a 3-D cell array

C = cell(2, 3, 4);
size(C)

Expected output:

ans =
     2     3     4

Matching the size of an existing matrix

A = ones(5, 2);
C = cell(size(A));
size(C)

Expected output:

ans =
     5     2

Using an exact typed-integer row size vector

sz = uint64([4 1]);
C = cell(sz);
size(C)

Expected output:

ans =
     4     1

Verifying that every cell starts with []

C = cell(2, 2);
isequal(C{1,1}, [], C{2,2}, [])

Expected output:

ans = logical
     1

Using cell with coding agents

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

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

FAQ

What values do new cells contain?⌄

Every cell created by a documented constructor form contains the empty 0×0 double array []. RunMat's separately mode-gated 'like' extension can choose another empty value, but that is not part of the compatibility contract.

Are negative or fractional sizes allowed?⌄

Finite fractional sizes are invalid. A signed negative integer size is treated as zero. All eight integer classes are parsed exactly; allocation still fails if the resulting element count exceeds platform limits.

Can I create zero-sized cell arrays?⌄

Yes. You can use cell(0), cell(0, n), or supply a size vector containing zeros. RunMat returns an empty cell array with the requested shape.

Can size controls reside on the GPU?⌄

The documented constructor has no interactive gpuArray surface. RunMat can gather a resident size vector and allocate the host cell array when its named GPU-size extension is enabled; MATLAB-compatible mode rejects before provider access.

What about N-dimensional cell arrays?⌄

RunMat supports N-dimensional cell arrays. Supply scalar dimensions or a row size vector; trailing dimensions whose size is one are ignored after the second dimension.

Does cell copy data from existing containers?⌄

No. The builtin only allocates empty cells. Populate the elements afterwards with assignments such as C{1,2} = magic(3);.

Related Cells functions

cell2mat · cell2struct · cellfun · cellstr · iscell · iscellstr · mat2cell · num2cell

Open-source implementation

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

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

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.

Download RunMatOpen Sandbox
On this page
  • Syntax
  • Inputs
  • Returns
  • Errors
  • How cell works
  • Does RunMat run cell on the GPU?
  • GPU memory and residency
  • Examples
  • Creating a square cell array of empty placeholders
  • Creating a rectangular 2-by-4 cell array
  • Creating a 3-D cell array
  • Matching the size of an existing matrix
  • Using an exact typed-integer row size vector
  • Verifying that every cell starts with []
  • Using cell with coding agents
  • FAQ
  • Related Cells functions
  • Open-source implementation
  • About RunMat