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.2, Nov 26, 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
    • arrayDatastore
    • csvread
    • csvwrite
    • detectImportOptions
    • dlmread
    • dlmwrite
    • fileDatastore
    • getvaropts
    • parquetDatastore
    • parquetinfo
    • parquetread
    • readcell
    • readmatrix
    • readtable
    • readtimetable
    • setvaropts
    • setvartype
    • spreadsheetImportOptions
    • writecell
    • writematrix
    • writetable
    • writetimetable
    • xlsread
    • xlswrite

dlmread — Read numeric data from delimiter-separated text files in MATLAB and RunMat.

dlmread(filename) reads numeric data from delimiter-separated ASCII text files. Custom delimiter, range, and offset forms follow MATLAB and RunMat compatibility semantics.

Syntax

M = dlmread(filename)
M = dlmread(filename, delimiter)
M = dlmread(filename, row, col)
M = dlmread(filename, delimiter, range)
M = dlmread(filename, delimiter, row, col)
M = dlmread(filename, delimiter, row, col, range)

Inputs

filename
Type
StringScalar
Required
Yes
Description
Delimited text file path.
delimiter
Type
Any
Required
Yes
Description
Delimiter as string/char or numeric code.
row
Type
IntegerScalar
Required
Yes
Description
Zero-based starting row offset.
col
Type
IntegerScalar
Required
Yes
Description
Zero-based starting column offset.
range
Type
Any
Required
Yes
Description
Range as A1-style string or numeric range vector.
NameTypeRequiredDefaultDescription
filenameStringScalarYes—Delimited text file path.
delimiterAnyYes—Delimiter as string/char or numeric code.
rowIntegerScalarYes—Zero-based starting row offset.
colIntegerScalarYes—Zero-based starting column offset.
rangeAnyYes—Range as A1-style string or numeric range vector.

Returns

M
Type
NumericArray
Description
Numeric matrix parsed from the delimited text file.
NameTypeDescription
MNumericArrayNumeric matrix parsed from the delimited text file.

Errors

—
When
Argument list does not match supported dlmread call forms.
Message
dlmread: invalid argument configuration
—
When
Delimiter value is invalid.
Message
dlmread: invalid delimiter
—
When
Row/column indices are invalid.
Message
dlmread: invalid row/column index
IdentifierWhenMessage
—Argument list does not match supported dlmread call forms.dlmread: invalid argument configuration
—Delimiter value is invalid.dlmread: invalid delimiter
—Row/column indices are invalid.dlmread: invalid row/column index
—Range specification is malformed or semantically invalid.dlmread: invalid range
—Filename argument is not a scalar string/char vector.dlmread: invalid filename input
—Filename resolves to an empty path.dlmread: filename must not be empty
—Input file cannot be opened.dlmread: unable to open file
—Input file cannot be read.dlmread: failed to read file
—A token cannot be parsed as numeric in the selected import region.dlmread: nonnumeric token encountered
—Internal tensor output materialization fails.dlmread: unable to construct output matrix

Behavior and forms

Accepts character vectors or string scalars for filename. String arrays must contain exactly one element.

The delimiter is optional. RunMat detects commas and otherwise treats repeated whitespace as one delimiter. An empty character vector or empty string scalar is the documented placeholder for this automatic delimiter behavior in forms such as dlmread(filename,'',R,C). Nonempty explicit delimiters use character vectors or string scalars. Numeric delimiter character codes are a named RunMat extension and reject in strict compatibility mode.

The strict-compatible omitted-delimiter offset form is dlmread(filename,'',R,C), where the empty placeholder requests automatic delimiter detection. Raw dlmread(filename,R,C) is a named RunMat-only shorthand. A nonempty delimiter can be supplied as dlmread(filename,delimiter,R,C); all forms use zero-based offsets and skip earlier rows or columns.

Documented zero-based row, column, and numeric range components accept double, single, or any of the eight integer classes. Typed integers are decoded from authoritative storage and must fit the host index type.

Spreadsheet ranges use forms such as "A1..B7". Colon spreadsheet notation is a separately named RunMat extension; omitted-delimiter ranges and offsets, two-element numeric start ranges, and offset-plus-range composition are also named extensions.

Empty fields (for example two adjacent delimiters) are interpreted as 0. Tokens such as NaN, Inf, and -Inf are accepted (case-insensitive).

Any other nonnumeric token raises an error that identifies the offending row and column using one-based indices (matching MATLAB diagnostic messages).

Results are dense double-precision tensors laid out in column-major order. Empty files yield a 0×0 tensor.

Leading UTF-8 byte order marks (BOM) are stripped automatically to match MATLAB's handling of spreadsheets that emit BOM-prefixed text files.

Paths may include ~ to reference the home directory; RunMat expands the token before opening the file.

Filesystem and execution

The filesystem provider, relative working directory and advertised resource lease are captured before resident controls gather. Reading uses that owner, remains on the host, and forms a fusion boundary. Worker calls need their own accessible file. Long parsing cooperates with the installed execution service; finite complete-call memory bounds for source lines, parsed rows and output remain a shared resource-admission requirement.

No device kernel or fusion route exists: only the named RunMat extension permits resident numeric controls, which are downloaded from their owning provider before parsing. A resident numeric filename is not scalar text and is rejected before download. The result is a host tensor; gpuArray(dlmread(...)) requests an explicit later device copy.

The historical programs and displayed values below are preserved; runnable examples use deterministic isolated-file fixtures instead of opening ambient paths:

Historical example 1 (Reading comma-delimited data by default):

writematrix([1 2 3; 4 5 6], "samples.csv");

M = dlmread("samples.csv")

delete("samples.csv");

Displayed output:

M =

1 2 3

4 5 6

Historical example 2 (Importing semicolon-separated values):

fid = fopen("scores.txt", "w");

fprintf(fid, "1;2;3\n4;5;6\n");

fclose(fid);

M = dlmread("scores.txt", ";")

delete("scores.txt");

Displayed output:

M =

1 2 3

4 5 6

Historical example 3 (Using tab characters as the delimiter):

fid = fopen("tabs.txt", "w");

fprintf(fid, "10\t11\t12\n13\t14\t15\n");

fclose(fid);

M = dlmread("tabs.txt", "\t")

delete("tabs.txt");

Displayed output:

M =

10 11 12

13 14 15

Historical example 4 (Skipping a header row and column (zero-based offsets)):

fid = fopen("with_header.txt", "w");

fprintf(fid, "Label,Jan,Feb\nalpha,1,2\nbeta,3,4\n");

fclose(fid);

M = dlmread("with_header.txt", ",", 1, 1)

delete("with_header.txt");

Displayed output:

M =

1 2

3 4

Historical example 5 (Extracting a rectangular range):

fid = fopen("block.txt", "w");

fprintf(fid, "10,11,12,13\n14,15,16,17\n18,19,20,21\n");

fclose(fid);

sub = dlmread("block.txt", ",", [1 1 2 3])

delete("block.txt");

Displayed output:

sub =

15 16 17

19 20 21

Historical example 6 (Treating empty fields as zeros):

fid = fopen("blanks.txt", "w");

fprintf(fid, "1,,3\n,5,\n7,8,\n");

fclose(fid);

M = dlmread("blanks.txt")

delete("blanks.txt");

Displayed output:

M =

1 0 3

0 5 0

7 8 0

Historical example 7 (Reading data with a numeric delimiter code):

fid = fopen("pipe.txt", "w");

fprintf(fid, "5|6|7\n8|9|10\n");

fclose(fid);

M = dlmread("pipe.txt", double('|'))

delete("pipe.txt");

Displayed output:

M =

5 6 7

8 9 10

Examples

Reading comma-delimited data by default

M = dlmread('samples.csv');
M

Expected output:

M =
     1     2     3
     4     5     6

Importing semicolon-separated values

M = dlmread('scores.txt',';');
M

Expected output:

M =
     1     2     3
     4     5     6

Using tab characters as the delimiter

M = dlmread('tabs.txt','\\t');
M

Expected output:

M =
    10    11    12
    13    14    15

Skipping a header row and column (zero-based offsets)

M = dlmread('with_header.txt',',',1,1);
M

Expected output:

M =
     1     2
     3     4

Extracting a rectangular range

sub = dlmread('block.txt',',',[1 1 2 3]);
sub

Expected output:

sub =
    15    16    17
    19    20    21

Treating empty fields as zeros

M = dlmread('blanks.txt');
M

Expected output:

M =
     1     0     3
     0     5     0
     7     8     0

Reading data with a numeric delimiter code

M = dlmread('pipe.txt',double('|'));
M

Expected output:

M =
     5     6     7
     8     9    10

Using dlmread with coding agents

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

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

FAQ

Can I omit the delimiter argument?⌄

Yes. RunMat detects comma-delimited input and otherwise coalesces repeated whitespace. Pass a character or string delimiter explicitly when needed.

Are row and column offsets zero-based like MATLAB?⌄

Yes. The R and C arguments count from zero. dlmread(filename, delimiter, 1, 2) skips the first row and the first two columns before reading data.

How do I specify a range?⌄

Provide a numeric vector [r1 c1 r2 c2] (zero-based, inclusive) or an Excel-style address such as "B2:D5". You can pass the range with or without a delimiter argument.

What happens if the file contains text tokens?⌄

Non-numeric fields trigger an error that includes the one-based row and column number of the offending token. Use readmatrix or readtable when you need to mix text and numbers.

How does dlmread treat empty cells?⌄

Empty cells evaluate to 0, matching MATLAB behavior. This includes consecutive delimiters and trailing delimiters.

Can I use whitespace as the delimiter?⌄

Yes. Pass " " (space), "\t" (tab), or the corresponding ASCII code. Multiple consecutive delimiters produce zeros where the values are missing.

Does dlmread respect locale-specific decimal separators?⌄

No. Parsing always uses . as the decimal separator, consistent with MATLAB.

Does dlmread change the working directory?⌄

No. Relative paths are resolved against the current working directory. dlmread never mutates global process state.

Why does the output stay on the CPU?⌄

dlmread performs synchronous file I/O, so the result resides in host memory. Wrap the result with gpuArray if you want a device-resident tensor.

Related Io functions

Tabular

arrayDatastore · csvread · csvwrite · detectImportOptions · dlmwrite · fileDatastore · getvaropts · parquetDatastore · parquetinfo · parquetread · readcell · readmatrix · readtable · readtimetable · setvaropts · setvartype · spreadsheetImportOptions · writecell · writematrix · writetable · writetimetable · xlsread · xlswrite

Net

accept · read · readline · tcpclient · tcpserver · write

Repl Fs

addpath · cd · copyfile · delete · dir · exist · fileattrib · fileparts · filesep · fullfile · genpath · getenv · getpref · isenv · isfile · isfolder · ispref · ls · matlabroot · memmapfile · memmapfile.subsasgn · memmapfile.subsref · mkdir · movefile · open · opentoline · path · pathsep · pcode · pwd · readstruct · rehash · restoredefaultpath · rmdir · rmpath · run · savepath · setenv · setpref · system · tempdir · tempname · uigetdir · uigetfile · uiputfile · unsetenv · userpath · what · winqueryreg · xmlread · xmlwrite

Audio

audioinfo · audioread

Io

clc · diary · disp · display · format · input

Data

commit · data.copy · data.create · data.delete · data.exists · data.export · data.import · data.inspect · data.list · data.move · data.open · DataArray.chunk_shape · DataArray.codec · DataArray.dtype · DataArray.fill · DataArray.name · DataArray.rank · DataArray.read · DataArray.resize · DataArray.shape · DataArray.write · Dataset.array · Dataset.arrays · Dataset.attrs · Dataset.begin · Dataset.get_attr · Dataset.has_array · Dataset.id · Dataset.path · Dataset.refresh · Dataset.set_attr · Dataset.set_attrs · Dataset.snapshot · Dataset.version · DataTransaction.abort · DataTransaction.commit · DataTransaction.create_array · DataTransaction.delete_array · DataTransaction.fill · DataTransaction.id · DataTransaction.resize · DataTransaction.set_attr · DataTransaction.set_attrs · DataTransaction.status · DataTransaction.write

Filetext

fclose · feof · fgetl · fgets · fileread · filewrite · fopen · fprintf · fread · frewind · fwrite · readlines · writelines

Archive

gunzip · gzip · unzip

Hdf5

h5disp · h5info · h5read · h5write · h5writeatt · hdf5info · hdf5read · hdf5write

Import

importdata · textscan

Json

jsondecode · jsonencode

Mat

load · matfile · matlab.io.MatFile.subsasgn · matlab.io.MatFile.subsref · save

Http

sendmail · urldecode · urlencode · weboptions · webread · websave · webwrite

Source you can read

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

  • View the source for dlmread 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 and forms
  • Filesystem and execution
  • Examples
  • Reading comma-delimited data by default
  • Importing semicolon-separated values
  • Using tab characters as the delimiter
  • Skipping a header row and column (zero-based offsets)
  • Extracting a rectangular range
  • Treating empty fields as zeros
  • Reading data with a numeric delimiter code
  • Using dlmread with coding agents
  • FAQ
  • Related Io functions
  • Tabular
  • Net
  • Repl Fs
  • Audio
  • Io
  • Data
  • Filetext
  • Archive
  • Hdf5
  • Import
  • Json
  • Mat
  • Http
  • Source you can read
  • About RunMat