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.1, Nov 17, 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
    • 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

strip — Remove leading and trailing characters from text with side and character-set controls.

strip(text) trims whitespace by default; optional direction and stripCharacters controls select a side and custom character set for supported text containers.

Syntax

out = strip(str)
out = strip(str, direction)
out = strip(str, stripCharacters)
out = strip(str, direction, stripCharacters)

Inputs

str
Type
Any
Required
Yes
Description
String, character, or cell text input.
direction
Type
StringScalar
Required
Yes
Default
"both"
Description
Side to strip: left, right, or both; RunMat also accepts leading and trailing.
stripCharacters
Type
Any
Required
Yes
Description
Scalar or shape-matched characters to remove.
NameTypeRequiredDefaultDescription
strAnyYes—String, character, or cell text input.
directionStringScalarYes"both"Side to strip: left, right, or both; RunMat also accepts leading and trailing.
stripCharactersAnyYes—Scalar or shape-matched characters to remove.

Returns

out
Type
Any
Description
Stripped text preserving input container kind and shape.
NameTypeDescription
outAnyStripped text preserving input container kind and shape.

Errors

RunMat:strip:InvalidInput
When
Input is not a string array, character array, or cell array of text scalars.
Message
strip: first argument must be a string array, character array, or cell array of character vectors
RunMat:strip:CellElement
When
Cell array contains a non-text or non-row character element.
Message
strip: cell array elements must be string scalars or character vectors
RunMat:strip:InvalidDirection
When
Direction is not left/right/both or an accepted synonym.
Message
strip: direction must be 'left', 'right', or 'both'
IdentifierWhenMessage
RunMat:strip:InvalidInputInput is not a string array, character array, or cell array of text scalars.strip: first argument must be a string array, character array, or cell array of character vectors
RunMat:strip:CellElementCell array contains a non-text or non-row character element.strip: cell array elements must be string scalars or character vectors
RunMat:strip:InvalidDirectionDirection is not left/right/both or an accepted synonym.strip: direction must be 'left', 'right', or 'both'
RunMat:strip:InvalidCharactersstripCharacters is not a valid text container.strip: characters to remove must be a string array, character vector, or cell array of character vectors
RunMat:strip:SizeMismatchPer-element stripCharacters does not match input shape and size.strip: stripCharacters must be the same size as the input when supplying multiple values
RunMat:strip:ArgCountMore than three inputs were supplied.strip: too many input arguments
RunMat:strip:InternalErrorOutput container construction failed.strip: internal error

Text and controls

strip(text) removes leading and trailing whitespace by default. Direction is case-insensitive: 'left' removes from the beginning, 'right' from the end, and 'both' from both sides. RunMat extension mode also accepts 'leading' and 'trailing' as aliases.

Supply a scalar stripCharacters value to remove a custom character instead of whitespace. RunMat extension mode also accepts multi-character sets and shape-matched string or cell arrays of per-element sets.

String scalars and arrays preserve their shape and typed missing elements. Character arrays are stripped row by row; the row count stays fixed and shorter rows are space-padded to the longest resulting width. Cell arrays preserve their layout and contain string scalars or character vectors.

Placement and errors

strip is a host text operation and is a fusion boundary. Numeric, logical, symbolic, and provider-resident inputs are not interpreted as characters and reject before provider access. A textual control or nested cell cannot make a numeric or resident value into a supported text input.

Invalid direction, strip-character type, per-element shape, or cell element raises a typed error. The operation has no provider kernel, callbacks, or external resource dependency.

Examples

Remove surrounding spaces

name = "   RunMat   ";
clean = strip(name)

Expected output:

clean = "RunMat"

Strip only the right side

labels = ["   Alpha   "; "   Beta     "; "   Gamma    "];
right_stripped = strip(labels, 'right')

Expected output:

right_stripped = ["   Alpha"; "   Beta"; "   Gamma"]

Remove leading zeroes

codes = ["00095"; "00137"; "00420"];
numeric = strip(codes, 'left', '0')

Expected output:

numeric = ["95"; "137"; "420"]

Keep character rows rectangular

animals = char("   cat  ", " dog", "cow   ");
trimmed = strip(animals)

Expected output:

trimmed = ['cat'; 'dog'; 'cow']

Use one character set per element

metrics = ["##pass##"; "--warn--"; "**fail**"];
per_char = ["#"; "-"; "*"];
normalized = strip(metrics, 'both', per_char)

Expected output:

normalized = ["pass"; "warn"; "fail"]

Strip a mixed text cell

pieces = {'  GPU  ', "   Accelerate", 'RunMat   '};
out = strip(pieces)

Expected output:

out = {'GPU', "Accelerate", 'RunMat'}

Using strip with coding agents

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

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

FAQ

Which direction keywords are supported?⌄

'left', 'right', and 'both' are the standard directions. RunMat extension mode also accepts 'leading' and 'trailing'. Matching is case-insensitive.

How can I remove characters other than whitespace?⌄

Pass one strip character in the standard mode, for example strip(text, 'x'). RunMat extension mode also accepts a set such as 'xyz'; every matching character is then removed from the chosen edge.

Can each element use different strip characters?⌄

In RunMat extension mode, a string or cell character-set array can match the input shape; each element then uses its corresponding set.

What happens to missing strings?⌄

Typed missing subject elements remain missing. Literal <missing> text is ordinary text; missing direction or character controls are rejected.

Does strip change character-array shape?⌄

Only width may change. Rows are stripped independently and padded to the longest resulting row.

Does strip execute on the GPU?⌄

No. It operates on host text; provider-resident numeric values are not automatically reinterpreted as text.

Related Strings functions

Transform

append · deblank · erase · eraseBetween · erasePunctuation · eraseURLs · extractAfter · extractBefore · extractBetween · insertAfter · insertBefore · join · lower · pad · replace · replaceBetween · reverse · split · splitlines · strcat · 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

Source you can read

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

  • View the source for strip 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
  • Text and controls
  • Placement and errors
  • Examples
  • Remove surrounding spaces
  • Strip only the right side
  • Remove leading zeroes
  • Keep character rows rectangular
  • Use one character set per element
  • Strip a mixed text cell
  • Using strip with coding agents
  • FAQ
  • Related Strings functions
  • Transform
  • Text Analytics
  • Core
  • Search
  • Pattern
  • Regex
  • Source you can read
  • About RunMat