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.2, Nov 26, 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
    • colon
    • createArray
    • empty
    • eye
    • false
    • full
    • inf
    • int16.empty
    • int32.empty
    • int64.empty
    • int8.empty
    • linspace
    • logspace
    • magic
    • meshgrid
    • nan
    • ndgrid
    • nonzeros
    • ones
    • peaks
    • rand
    • randi
    • randn
    • randperm
    • range
    • sparse
    • spdiags
    • speye
    • spones
    • sprand
    • true
    • uint16.empty
    • uint32.empty
    • uint64.empty
    • uint8.empty
    • zeros

createArray — Create an array of a specified class and value.

createArray accepts dimensions first, followed by an optional class name and Like or FillValue name-value arguments. Integer dimensions are structural and exact. Integer FillValue and Like forms preserve authoritative class, complexity, and resident storage. The result is complex when either Like or FillValue is complex.

Syntax

X = createArray(sz1, ..., szN, classname?, Like=prototype?, FillValue=value?)

Inputs

arguments
Type
Any
Required
Variadic
Description
Dimensions, optional class name, and Like/FillValue name-value arguments.
NameTypeRequiredDefaultDescription
argumentsAnyVariadic—Dimensions, optional class name, and Like/FillValue name-value arguments.

Returns

A
Type
Any
Description
Constant-valued output array.
NameTypeDescription
AAnyConstant-valued output array.

Errors

—
When
The fill value is not scalar.
Message
createArray: FillValue must be a scalar
—
When
The fill value type is unsupported.
Message
createArray: unsupported FillValue type
—
When
The 'like' keyword is provided without a prototype argument.
Message
createArray: Like requires a prototype
IdentifierWhenMessage
—The fill value is not scalar.createArray: FillValue must be a scalar
—The fill value type is unsupported.createArray: unsupported FillValue type
—The 'like' keyword is provided without a prototype argument.createArray: Like requires a prototype
—The 'like' keyword is provided multiple times.createArray: Like may be specified only once
—A class keyword and a 'like' prototype are both provided.createArray: classname and Like cannot be combined
—An unsupported output class is requested.createArray: unsupported class
—A trailing option string is not recognized.createArray: unrecognized option
—Dimension arguments fail numeric/shape parsing.createArray: dimensions must be integer values

Behavior

createArray returns scalar double zero.

createArray(n) creates an n-by-n array and createArray(m,n,...) creates the requested shape.

Negative dimensions are treated as zero.

A trailing class name selects the output class.

FillValue selects the repeated scalar value and preserves its class unless classname or Like requests assignment conversion. Without Like, a GPU-resident FillValue contributes residency and owning provider but does not override an explicit classname.

Like preserves numeric class and GPU residency; classname and Like cannot be combined.

If either Like or FillValue is complex, the output is complex. A real single Like therefore produces complex single for a complex FillValue, while a real double Like produces complex double.

Execution and residency

Like and GPU FillValue forms use the source handle's owning provider for fill and fallback upload paths; native real and paired-complex integer storage remains exact and the output remains on that owner/device.

Examples

Integer array

A = createArray(2,3,'uint64',FillValue=uint64(7));

Expected output:

2-by-3 uint64 array of sevens

Prototype

A = createArray(2,3,Like=uint16(1),FillValue=8);

Expected output:

2-by-3 uint16 array

Complex FillValue with a real prototype

A = createArray(2,Like=single(0),FillValue=1+2i);

Expected output:

2-by-2 complex single array

Using createArray with coding agents

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

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

FAQ

How is createArray different from fill?⌄

createArray constructs arrays; fill creates 2-D Patch graphics.

Related Array functions

Creation

colon · empty · eye · false · full · inf · int16.empty · int32.empty · int64.empty · int8.empty · linspace · logspace · magic · meshgrid · nan · ndgrid · nonzeros · ones · peaks · rand · randi · randn · randperm · range · sparse · spdiags · speye · spones · sprand · true · uint16.empty · uint32.empty · uint64.empty · uint8.empty · zeros

Accumulation

accumarray

Sorting Sets

argsort · intersect · ismember · ismembertol · issorted · issortedrows · setdiff · setxor · sort · sortrows · union · unique

Shape

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

Combinatorics

combinations · nchoosek · perms

Binning

discretize

Indexing

find · ind2sub · sub2ind

Grouping

findgroups · groupcounts · grp2idx · splitapply

Introspection

height · iscolumn · isempty · ismatrix · isrow · isscalar · isvector · length · ndims · numel · size · width

Source you can read

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

  • View the source for createArray 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
  • Behavior
  • Execution and residency
  • Examples
  • Integer array
  • Prototype
  • Complex FillValue with a real prototype
  • Using createArray with coding agents
  • FAQ
  • Related Array functions
  • Creation
  • Accumulation
  • Sorting Sets
  • Shape
  • Combinatorics
  • Binning
  • Indexing
  • Grouping
  • Introspection
  • Source you can read
  • About RunMat