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

cell2struct — Convert a cell array into a struct or struct array.

cell2struct(C, fields, dim) maps entries along dimension dim of C to named fields. Remaining dimensions become the struct-array shape.

Syntax

S = cell2struct(C, fields, dim)

Inputs

NameTypeRequiredDefaultDescription
CAnyYes—Cell array containing field values.
fieldsAnyYes—Field names as char, string, or cellstr.
dimIntegerScalarNo1Dimension whose entries correspond to field names.

Returns

NameTypeDescription
SAnyStruct or struct array result.

Errors

IdentifierWhenMessage
RunMat:cell2struct:InvalidInputArguments are not a cell array, field-name list, and valid dimension.cell2struct: invalid input
RunMat:cell2struct:ShapeMismatchThe number of field names does not match the selected cell dimension.cell2struct: field count does not match selected dimension

How cell2struct works

  • fields may be a string scalar, string array, character matrix, character vector, or cell array of text scalars.
  • The selected dimension must have the same extent as the number of field names.
  • The dimension defaults to 1 and accepts exact positive scalar values from all eight integer classes.
  • Integer payloads remain exact values in their original class, including wide int64 and uint64 values.
  • When the remaining dimensions contain a single element, the result is a scalar struct.
  • Larger remaining dimensions are represented as a RunMat struct-array cell container.

Does RunMat run cell2struct on the GPU?

No GPU kernels are launched.

GPU memory and residency

The result is host-resident.

Example

Converting a row cell into a scalar struct

S = cell2struct({1, 'Ada'}, {'id','name'}, 2)

Expected output:

S = struct with fields: id, name

Using cell2struct with coding agents

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

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

FAQ

Why are non-scalar struct arrays represented as cells?⌄

RunMat currently represents struct arrays as cell arrays containing struct values, matching existing table and struct-array runtime conventions.

Related Cells functions

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

Open-source implementation

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

  • View the source for cell2struct 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 cell2struct works
  • Does RunMat run cell2struct on the GPU?
  • GPU memory and residency
  • Example
  • Converting a row cell into a scalar struct
  • Using cell2struct with coding agents
  • FAQ
  • Related Cells functions
  • Open-source implementation
  • About RunMat