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
    • append
    • deblank
    • erase
    • eraseBetween
    • erasePunctuation
    • eraseURLs
    • extractAfter
    • extractBefore
    • extractBetween
    • insertAfter
    • insertBefore
    • join
    • lower
    • pad
    • replace
    • replaceBetween
    • reverse
    • split
    • splitlines
    • strcat
    • strip
    • strjoin
    • strjust
    • strrep
    • strsplit
    • strtrim
    • upper

split — Split text values into substrings using delimiter rules with MATLAB-compatible container behavior.

split(text) breaks text into substrings separated by delimiters across string, char, and cell-text inputs. It follows MATLAB-compatible default-delimiter and output-container behavior, including whitespace splitting when no delimiter is provided.

Syntax

newStr = split(str)
newStr = split(str, delimiter)
[newStr, match] = split(str, delimiter, dim)
newStr = split(str, delimiter, Name, Value, ...)
newStr = split(str, Name, Value, ...)

Inputs

NameTypeRequiredDefaultDescription
strAnyYes—Input text scalar/array/cell to split.
delimiterAnyYes—Delimiter scalar/array/cell.
dimIntegerScalarYes—Positive dimension along which output substrings are oriented.
NameStringScalarYes—Option name (`CollapseDelimiters` or `IncludeDelimiters`).
ValueAnyVariadic—Option values and additional Name/Value pairs.

Returns

NameTypeDescription
newStrAnyString or cell array containing split tokens.
matchAnyString or cell array containing the delimiters at which splitting occurred.

Returned values from split depend on how many outputs the caller requests.

Errors

IdentifierWhenMessage
RunMat:split:InvalidInputFirst argument is not a string scalar/array, char array, or cell array of text scalars.split: first argument must be a string scalar, string array, character array, or cell array of character vectors
RunMat:split:DelimiterTypeDelimiter input is not a supported text scalar/array/cell.split: delimiter input must be a string scalar, string array, character array, or cell array of character vectors
RunMat:split:NameValuePairName-value options are not supplied in complete pairs.split: name-value arguments must be supplied in pairs
RunMat:split:UnknownNameAn option name is not recognized.split: unrecognized name-value argument; supported names are 'CollapseDelimiters' and 'IncludeDelimiters'
RunMat:split:EmptyDelimiterDelimiter list is empty or contains empty delimiter entries.split: delimiters must contain at least one character
RunMat:split:CellElementCell arrays contain non-text elements or non-row char arrays.split: cell array elements must be string scalars or character vectors
RunMat:split:OptionValueOption values are not logical true/false values.split: option values must be logical true or false
RunMat:split:DimensionThe dimension argument is not a positive integer scalar in RunMat's supported rank range of 1 through 1024.split: dimension must be a positive integer scalar no greater than 1024
RunMat:split:InternalErrorInternal output container construction failed.split: internal error

How split works

  • The default delimiter is whitespace (isspace), and consecutive whitespace is treated as a single separator (equivalent to 'CollapseDelimiters', true).
  • When you supply explicit delimiters, they can be a string scalar, string array, character array (rows), or a cell array of character vectors. Delimiters are matched left to right and the longest delimiter wins when several candidates match at the same position.
  • RunMat mode retains the advanced 'CollapseDelimiters' and 'IncludeDelimiters' options behind one compatibility gate; they are not presented as MATLAB-compatible split options.
  • A documented positive double dim controls output orientation. Typed integer dimensions are available only in RunMat mode because the compatibility target does not enumerate their storage classes. RunMat rejects dimensions above its supported rank ceiling of 1024 before allocating shape metadata.
  • Without an explicit dimension, scalar input produces an N×1 string column, a column vector produces M×N, and a multidimensional input appends the token dimension. An explicit dimension inserts or replaces that dimension using column-major ordering.
  • When requested, the second output contains the matched delimiters with the same orientation rules. Missing values are padded with <missing>.
  • Missing string scalars propagate unchanged.

Does RunMat run split on the GPU?

split executes on the CPU. Numeric resident values in text or delimiter roles reject without provider access; only an admitted dimension control may gather.

GPU memory and residency

Text and delimiters are host-only. Automatically placed double dimensions gather transparently; explicit resident dimensions are compatibility-gated before gather.

Examples

Split A String On Whitespace

txt = "RunMat Accelerate Planner";
pieces = split(txt)

Expected output:

pieces = 3×1 string
    "RunMat"
    "Accelerate"
    "Planner"

Split A String Using A Custom Delimiter

csv = "alpha,beta,gamma";
tokens = split(csv, ",")

Expected output:

tokens = 3×1 string
    "alpha"
    "beta"
    "gamma"

Include Delimiters In The Output

expr = "A+B-C";
segments = split(expr, ["+", "-"], "IncludeDelimiters", true)

Expected output:

segments = 5×1 string
    "A"
    "+"
    "B"
    "-"
    "C"

Preserve Empty Segments When CollapseDelimiters Is False

values = "one,,three,";
parts = split(values, ",", "CollapseDelimiters", false)

Expected output:

parts = 4×1 string
    "one"
    ""
    "three"
    ""

Split Each Row Of A Character Array

rows = char("GPU Accelerate", "VM Interpreter");
result = split(rows)

Expected output:

result = 2×2 string
    "GPU"          "Accelerate"
    "VM"           "Interpreter"

Split Elements Of A Cell Array

C = {'RunMat Snapshot'; "Fusion Planner"};
out = split(C, " ")

Expected output:

out = 2×2 string
    "RunMat"    "Snapshot"
    "Fusion"    "Planner"

Handle Missing String Inputs

names = ["RunMat"; "<missing>"; "Accelerate Engine"];
split_names = split(names)

Expected output:

split_names = 3×2 string
    "RunMat"        "<missing>"
    "<missing>"     "<missing>"
    "Accelerate"    "Engine"

Using split with coding agents

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

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

FAQ

What delimiters does split use by default?⌄

When you omit the second argument, split treats any Unicode whitespace as a delimiter and collapses consecutive whitespace runs so they produce a single split point.

How do explicit delimiters change the defaults?⌄

Providing explicit delimiters switches the internal collapse default to false. RunMat mode can override it with the compatibility-gated advanced option.

What happens when 'IncludeDelimiters' is true?⌄

This is a RunMat-mode extension. Matched delimiters are inserted between tokens in original order, with missing values used for padding.

How is the output sized for string arrays?⌄

Default orientation follows the documented input-shape rules: scalar input becomes N×1, a column vector becomes M×N, and multidimensional input gains a trailing token dimension. An explicit positive dimension controls where that token axis is placed.

How does split handle missing strings?⌄

Missing string scalars propagate unchanged. When padding is required, <missing> is used so MATLAB and RunMat stay aligned.

Can I provide empty delimiters?⌄

No. Empty delimiters are disallowed, matching MATLAB's input validation. Specify at least one character per delimiter.

Which argument types are accepted as delimiters?⌄

You may pass string scalars, string arrays, character arrays (each row is a delimiter), or cell arrays containing string scalars or character vectors.

How is split different from strsplit?⌄

split is the vectorized string-focused builtin in RunMat. Use strsplit when you need the MATLAB-style scalar-text API with optional matches output and DelimiterType handling.

Related Strings functions

Transform

append · deblank · erase · eraseBetween · erasePunctuation · eraseURLs · extractAfter · extractBefore · extractBetween · insertAfter · insertBefore · join · lower · pad · replace · replaceBetween · reverse · splitlines · strcat · strip · strjoin · strjust · strrep · strsplit · strtrim · upper

Text Analytics

addDependencyDetails · addEntityDetails · addLemmaDetails · addPartOfSpeechDetails · addSentenceDetails · addTypeDetails · bagOfNgrams · bagOfWords · cosineSimilarity · doc2sequence · encode · extractFileText · extractHTMLText · fastTextWordEmbedding · findElement · getAttribute · htmlTree · ind2word · isVocabularyWord · normalizeWords · readWordEmbedding · removeLongWords · removeShortWords · removeStopWords · removeWords · stopWords · tokenDetails · tokenizedDocument · trainWordEmbedding · vaderSentimentScores · vec2word · word2ind · word2vec · wordEncoding · writeWordEmbedding

Core

blanks · char · compose · convertCharsToStrings · convertContainedStringsToChars · convertStringsToChars · genvarname · int2str · isletter · isspace · isStringScalar · isstrprop · mat2str · native2unicode · newline · num2str · sprintf · sscanf · str2double · str2num · strcmp · strcmpi · string · string.empty · strings · strlength · strncmp · strncmpi · strtok · unicode2native

Search

contains · endsWith · matches · startsWith · strfind

Pattern

digitsPattern · lettersPattern · pattern · regexpPattern · textBoundary · wildcardPattern

Regex

regexp · regexpi · regexprep

Open-source implementation

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

  • View the source for split 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 split works
  • Does RunMat run split on the GPU?
  • GPU memory and residency
  • Examples
  • Split A String On Whitespace
  • Split A String Using A Custom Delimiter
  • Include Delimiters In The Output
  • Preserve Empty Segments When CollapseDelimiters Is False
  • Split Each Row Of A Character Array
  • Split Elements Of A Cell Array
  • Handle Missing String Inputs
  • Using split with coding agents
  • FAQ
  • Related Strings functions
  • Transform
  • Text Analytics
  • Core
  • Search
  • Pattern
  • Regex
  • Open-source implementation
  • About RunMat