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
    • 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

extractFileText — Read text from plain text, HTML, and DOCX files.

extractFileText(filename) reads text from a host file and returns a string scalar. This slice supports plain text files with encodings, HTML files through RunMat's extractHTMLText parser, and DOCX files by extracting word/document.xml text.

Syntax

str = extractFileText(filename)
str = extractFileText(filename,Name,Value)

Inputs

NameTypeRequiredDefaultDescription
filenameAnyYes—Path to a text, HTML, or DOCX file.
NameValueAnyVariadic—Name-value options: Encoding, ExtractionMethod, Password, and Pages.

Returns

NameTypeDescription
strStringScalarExtracted text.

Errors

IdentifierWhenMessage
RunMat:extractFileText:InvalidInputInputs do not match a supported extractFileText form.extractFileText: invalid input
RunMat:extractFileText:IOErrorThe requested file cannot be read.extractFileText: file read failed
RunMat:extractFileText:UnsupportedFormatThe requested file type or option requires unsupported extraction infrastructure.extractFileText: unsupported file type or option

How extractFileText works

  • Documented filename/URL input is a string scalar, character vector, or 1-by-1 cell containing a character vector. A string-valued or nested filename cell is a RunMat extension.
  • Plain text files are decoded as UTF-8 by default. The Encoding name-value option accepts labels supported by encoding_rs, such as UTF-8, windows-1252, and ISO-8859-1.
  • HTML files with extensions .html, .htm, and .xhtml are decoded as text and passed to extractHTMLText.
  • For HTML files, ExtractionMethod accepts "tree", "article", or "all-text" and follows the existing extractHTMLText compatibility behavior.
  • DOCX files are read as zip archives and text is extracted from word/document.xml, preserving paragraph breaks and basic tabs/line breaks.
  • The documented Pages option is a nonempty vector of positive values in single, double, or any of the eight integer classes. RunMat parses these controls exactly from native storage, but PDF extraction itself remains unsupported.
  • PDF extraction, website/URL fetching, password-protected documents, legacy binary DOC, and full Microsoft Word layout fidelity remain tracked by the broader Text Analytics compatibility issue.
  • Integer, logical, complex, and resident numeric filename values reject before file IO or provider access. Resident Pages controls require RunMat extension mode.
  • Unknown file extensions are treated as plain text files.

GPU memory and residency

extractFileText performs host file IO and text parsing and has no provider kernel.

Examples

Read Plain Text

str = extractFileText("notes.txt")

Expected output:

`str` is the file contents as a string scalar.

Read HTML Text

str = extractFileText("page.html", "ExtractionMethod", "all-text")

Expected output:

`str` contains visible text extracted from the HTML file.

Read DOCX Text

str = extractFileText("report.docx")

Expected output:

`str` contains the text runs from the DOCX main document part.

Using extractFileText with coding agents

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

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

FAQ

Does extractFileText support PDF files?⌄

Not yet. RunMat rejects PDF-specific forms with a clear error and keeps PDF extraction in the broader Text Analytics queue.

Does extractFileText read websites?⌄

Not in this slice. URL extraction requires web fetching behavior and remains tracked.

Does extractFileText execute on the GPU?⌄

No. It performs host file IO and text parsing.

Related Strings functions

Text Analytics

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

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

  • View the source for extractFileText 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 extractFileText works
  • GPU memory and residency
  • Examples
  • Read Plain Text
  • Read HTML Text
  • Read DOCX Text
  • Using extractFileText with coding agents
  • FAQ
  • Related Strings functions
  • Text Analytics
  • Transform
  • Core
  • Search
  • Pattern
  • Regex
  • Open-source implementation
  • About RunMat