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.

tail\";\nstr = extractHTMLText(code, \"ExtractionMethod\", \"all-text\")"},{"@type":"HowToStep","name":"Extract From htmlTree","url":"https://runmat.com/docs/reference/builtins/extracthtmltext#extract-from-htmltree","text":"tree = htmlTree(\"

Title

Body & tail

\");\nstr = extractHTMLText(tree)"}]},{"@type":"FAQPage","@id":"https://runmat.com/docs/reference/builtins/extracthtmltext#faq","mainEntity":[{"@type":"Question","name":"Are `tree` and `article` exact MATLAB article extraction modes?","acceptedAnswer":{"@type":"Answer","text":"

No. Both modes currently use RunMat's paragraph/block extraction heuristic. Exact article scoring remains part of the broader Text Analytics compatibility work.

"}},{"@type":"Question","name":"Does `extractHTMLText` support arrays?","acceptedAnswer":{"@type":"Answer","text":"

Yes. Documented string arrays, cell arrays of character vectors, and htmlTree arrays produce string arrays with the same shape. Row-wise character matrices and broader or mixed cells require RunMat extension mode.

"}},{"@type":"Question","name":"Does `extractHTMLText` execute on the GPU?","acceptedAnswer":{"@type":"Answer","text":"

No. HTML extraction is host text processing and has no runmat-accelerate provider path.

"}}]}]}
/
See all docs
Builtin Reference
    • 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

extractHTMLText — Extract visible text from HTML code or htmlTree objects.

extractHTMLText extracts visible text from HTML code or from an htmlTree object. It supports the documented ExtractionMethod option values "tree", "article", and "all-text".

Syntax

str = extractHTMLText(code)
str = extractHTMLText(___, 'ExtractionMethod', method)

Inputs

code
Type
Any
Required
Yes
Description
HTML code or htmlTree object.
Name
Type
StringScalar
Required
Yes
Default
ExtractionMethod
Description
Extraction method option name.
method
Type
StringScalar
Required
Yes
Default
tree
Description
Extraction method: tree, article, or all-text.
NameTypeRequiredDefaultDescription
codeAnyYes—HTML code or htmlTree object.
NameStringScalarYesExtractionMethodExtraction method option name.
methodStringScalarYestreeExtraction method: tree, article, or all-text.

Returns

str
Type
Any
Description
Extracted text.
NameTypeDescription
strAnyExtracted text.

Errors

RunMat:html:InvalidInput
When
Inputs are not a supported htmlTree or extractHTMLText form.
Message
HTML Text Analytics helper received invalid input
RunMat:extractHTMLText:TooManyOutputs
When
More than one output is requested.
Message
extractHTMLText: too many output arguments
IdentifierWhenMessage
RunMat:html:InvalidInputInputs are not a supported htmlTree or extractHTMLText form.HTML Text Analytics helper received invalid input
RunMat:extractHTMLText:TooManyOutputsMore than one output is requested.extractHTMLText: too many output arguments

Supported forms

str = extractHTMLText(code)

str = extractHTMLText(tree)

str = extractHTMLText(___, 'ExtractionMethod', method)

str is a string scalar or string array.

method must be "tree", "article", or "all-text".

The option name is case-insensitive and must be ExtractionMethod.

Behavior

Documented extractHTMLText(code) input is a string array, character vector, or cell array of character vectors. Row-wise character matrices and cells containing string scalars are RunMat extensions.

extractHTMLText(tree) accepts RunMat htmlTree objects and homogeneous arrays of those objects.

extractHTMLText(___, 'ExtractionMethod', method) accepts tree, article, or all-text.

String arrays, cell arrays, htmlTree arrays, and extension-mode character matrices return string arrays with the input shape.

Script, style, noscript, template, and head content is excluded from extracted text.

Common HTML entities and numeric character references are decoded.

tree and article currently use the same paragraph/block extraction heuristic. RunMat does not yet implement MathWorks' exact article scoring algorithm.

all-text extracts normalized body text outside skipped elements. Whitespace is normalized for MATLAB-friendly string output.

The builtin has no integer role: all eight integer classes, logical and complex values, and resident numeric handles reject without numeric-to-text conversion or provider access.

Execution and residency

extractHTMLText parses host text and htmlTree objects and does not use provider kernels. Numeric resident handles reject before provider access.

extractHTMLText parses host-resident text and has no provider kernel.

Implementation boundary

The existing host HTML parser excludes nonvisible elements and decodes entities. Tree and article share a block heuristic, not the complete MATLAB article-scoring algorithm. Host parsing/scratch has no complete finite owner or provider text kernel.

Finite host allocation

The current implementation requires an Unbounded host allocation policy. Under Managed finite allocation, a shared family guard rejects before gather, parsing, model cloning, chart mutation or filesystem work because complete host scratch and metadata ownership is not yet implemented. Authority is checked again after suspension and before publication, and failures are terminal rather than permission to replay. This refusal is an implementation frontier, not completion of finite resource support.

Examples

Extract Text From HTML

code = "<html><body><h1>THE SONNETS</h1><p>by William Shakespeare</p></body></html>";
str = extractHTMLText(code)

Expected output:

str = "THE SONNETS\n\nby William Shakespeare"

Use all-text Extraction

code = "<body><style>.x{}</style><p>visible</p><script>hidden()</script><span>tail</span></body>";
str = extractHTMLText(code, "ExtractionMethod", "all-text")

Expected output:

str = "visible tail"

Extract From htmlTree

tree = htmlTree("<article><h2>Title</h2><p>Body &amp; tail</p></article>");
str = extractHTMLText(tree)

Expected output:

str = "Title\n\nBody & tail"

Using extractHTMLText with coding agents

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

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

FAQ

Are tree and article exact MATLAB article extraction modes?⌄

No. Both modes currently use RunMat's paragraph/block extraction heuristic. Exact article scoring remains part of the broader Text Analytics compatibility work.

Does extractHTMLText support arrays?⌄

Yes. Documented string arrays, cell arrays of character vectors, and htmlTree arrays produce string arrays with the same shape. Row-wise character matrices and broader or mixed cells require RunMat extension mode.

Does extractHTMLText execute on the GPU?⌄

No. HTML extraction is host text processing and has no runmat-accelerate provider path.

Related Strings functions

Text Analytics

addDependencyDetails · addEntityDetails · addLemmaDetails · addPartOfSpeechDetails · addSentenceDetails · addTypeDetails · bagOfNgrams · bagOfWords · cosineSimilarity · doc2sequence · encode · extractFileText · 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

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

  • View the source for extractHTMLText 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
  • Supported forms
  • Behavior
  • Execution and residency
  • Implementation boundary
  • Finite host allocation
  • Examples
  • Extract Text From HTML
  • Use all-text Extraction
  • Extract From htmlTree
  • Using extractHTMLText with coding agents
  • FAQ
  • Related Strings functions
  • Text Analytics
  • Transform
  • Core
  • Search
  • Pattern
  • Regex
  • Source you can read
  • About RunMat