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
    • contains
    • endsWith
    • matches
    • startsWith
    • strfind

endsWith — Test whether text inputs end with patterns in MATLAB and RunMat.

endsWith(str, pattern) returns one logical result for each element of str. When pattern has multiple elements, each element is an alternative and a subject matches if any pattern is a suffix.

Syntax

tf = endsWith(str, pat)
tf = endsWith(str, pat, ignoreCase)
tf = endsWith(str, pat, "IgnoreCase", value)

Inputs

str
Type
Any
Required
Yes
Description
Text input (string/char/cell/string array).
pat
Type
Any
Required
Yes
Description
Pattern text (string/char/cell/string array).
ignoreCase
Type
Any
Required
Yes
Default
false
Description
Logical flag controlling case-sensitive matching.
name
Type
StringScalar
Required
Yes
Default
"IgnoreCase"
Description
Option name (`"IgnoreCase"`).
value
Type
Any
Required
Yes
Description
Option value for `"IgnoreCase"`.
NameTypeRequiredDefaultDescription
strAnyYes—Text input (string/char/cell/string array).
patAnyYes—Pattern text (string/char/cell/string array).
ignoreCaseAnyYesfalseLogical flag controlling case-sensitive matching.
nameStringScalarYes"IgnoreCase"Option name (`"IgnoreCase"`).
valueAnyYes—Option value for `"IgnoreCase"`.

Returns

tf
Type
LogicalArray
Description
Logical result indicating whether each text element ends with the pattern.
NameTypeDescription
tfLogicalArrayLogical result indicating whether each text element ends with the pattern.

Errors

RunMat:endsWith:InvalidInput
When
Text or pattern input is not a supported text container.
Message
endsWith: text and pattern inputs must be text values
RunMat:endsWith:InvalidOption
When
IgnoreCase option arguments are invalid or malformed.
Message
endsWith: invalid option arguments
RunMat:endsWith:InternalError
When
Internal logical result assembly failed.
Message
endsWith: internal error
IdentifierWhenMessage
RunMat:endsWith:InvalidInputText or pattern input is not a supported text container.endsWith: text and pattern inputs must be text values
RunMat:endsWith:InvalidOptionIgnoreCase option arguments are invalid or malformed.endsWith: invalid option arguments
RunMat:endsWith:InternalErrorInternal logical result assembly failed.endsWith: internal error

Behavior

Accepts text inputs as string scalars/arrays, character vectors/arrays, or cell arrays of character vectors.

Accepts patterns in the same formats. Multiple patterns form an alternatives set rather than an element-wise array paired with str.

Typed missing string scalars (displayed as <missing>) never match any pattern.

Empty patterns ("" or '') always match non-missing text elements.

Typed missing pattern elements never match and therefore return false; literal <missing> patterns are ordinary text.

Character arrays treat each row as an independent element; zero-row character arrays yield empty outputs.

MATLAB-compatible mode accepts the documented 'IgnoreCase', logical name-value form. RunMat mode additionally supports a positional flag and numeric or textual predicate values behind explicit extension gates.

Returns a logical scalar for a scalar subject and otherwise returns a logical array with the shape of str.

Placement and effects

Matching operates on host text. The builtin has no text GPU kernel or fusion form; numeric and resident text-role inputs reject before provider access. It may throw for malformed arguments and options, but does not mutate workspace state or access files, network, randomness, or time.

An unused result is still evaluated and discarded. Ordinary host-text distribution is distinct from distributed-input support for this builtin.

Examples

Check if a filename ends with an extension

tf = endsWith("report.pdf", ".pdf")

Expected output:

tf = logical
   1

Perform a case-insensitive suffix test

tf = endsWith("RunMat", "MAT", 'IgnoreCase', true)

Expected output:

tf = logical
   1

Apply a scalar suffix to every element of a string array

labels = ["alpha" "beta" "gamma"];
tf = endsWith(labels, "ma")

Expected output:

tf = 1×3 logical array
   0   0   1

Test every subject against a set of suffixes

names = ["hydrogen"; "helium"; "lithium"];
suffixes = ["gen"; "ium"];
tf = endsWith(names, suffixes)

Expected output:

tf = 3×1 logical array
   1
   1
   1

Test suffixes for a cell array of character vectors

C = {'Mercury', 'Venus', 'Mars'};
tf = endsWith(C, 's')

Expected output:

tf = 1×3 logical array
   0   1   1

Provide multiple suffixes

tf = endsWith("saturn", ["n" "x" "r"])

Expected output:

tf = logical
   1

Handle empty patterns and missing values

texts = ["", string(missing)];
tf = endsWith(texts, "")

Expected output:

tf = 1×2 logical array
   1   0

Using endsWith with coding agents

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

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

FAQ

What types can I pass to endsWith?⌄

Use string arrays, character vectors, or cell arrays of character vectors for both arguments. Every pattern is tested as an alternative against each subject element.

How do I ignore letter case?⌄

MATLAB-compatible mode uses 'IgnoreCase', true or false. RunMat mode additionally accepts textual values such as 'on' and a positional flag behind explicit extension gates. The option name is case-insensitive.

What happens with empty patterns?⌄

Empty patterns ("" or '') always match non-missing text elements. When the text element is missing (<missing>), the result is false.

Can I provide multiple suffixes at once?⌄

Yes. Provide pattern as a string array, character vector, cell array of character vectors, or supported pattern object. A subject returns true when any supplied pattern is a suffix.

How are missing strings treated?⌄

Missing string scalars (displayed as <missing>) never match any pattern and produce false in the result. Use ismissing if you need to handle missing values separately.

Does endsWith run on the GPU?⌄

Text matching runs on the host and has no GPU text kernel. Numeric or resident values in text roles are rejected before provider access; supported scalar controls are handled separately.

Does endsWith preserve the input shape?⌄

Yes. The output has the shape of str; pattern-array shape does not change it. A scalar subject produces a logical scalar.

Related Strings functions

Search

contains · matches · startsWith · strfind

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

Transform

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

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

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 endsWith is executed, line by line, in Rust.

  • View the source for endsWith 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
  • Placement and effects
  • Examples
  • Check if a filename ends with an extension
  • Perform a case-insensitive suffix test
  • Apply a scalar suffix to every element of a string array
  • Test every subject against a set of suffixes
  • Test suffixes for a cell array of character vectors
  • Provide multiple suffixes
  • Handle empty patterns and missing values
  • Using endsWith with coding agents
  • FAQ
  • Related Strings functions
  • Search
  • Text Analytics
  • Transform
  • Core
  • Pattern
  • Regex
  • Source you can read
  • About RunMat