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

importdata — Import numeric text data with optional headers.

A = importdata(filename) imports legacy numeric text files, returning either a numeric matrix or a structure containing imported data plus header metadata.

Syntax

A = importdata(filename)
A = importdata(filename, delimiterIn)
A = importdata(filename, delimiterIn, headerlinesIn)
[A, delimiterOut, headerlinesOut] = importdata(filename, delimiterIn, headerlinesIn)

Inputs

NameTypeRequiredDefaultDescription
filenameStringScalarYes—File to import.
delimiterInStringScalarNo—Delimiter to use for text files.
headerlinesInIntegerScalarNo—Number of header lines to skip.

Returns

NameTypeDescription
AAnyImported numeric matrix or import structure.
delimiterOutStringScalarDetected or requested text delimiter.
headerlinesOutNumericScalarNumber of imported header lines.

Returned values from importdata depend on how many outputs the caller requests.

Errors

IdentifierWhenMessage
RunMat:importdata:InvalidArgumentFilename, delimiter, or header line arguments are malformed.importdata: invalid argument
RunMat:importdata:IoThe input file cannot be read.importdata: unable to read file
RunMat:importdata:ParseText content cannot be imported as supported numeric/header data.importdata: unable to parse text data

How importdata works

  • Supports importdata(filename), importdata(filename, delimiterIn), and importdata(filename, delimiterIn, headerlinesIn).
  • Automatically detects comma, tab, semicolon, pipe, or whitespace delimiters from non-empty lines when no delimiter is supplied.
  • Pure numeric files return a double tensor directly, matching MATLAB's convenient legacy behavior.
  • Files with header rows return a struct with data, textdata, and, when inferable, colheaders.
  • Files with leading row labels return a struct with rowheaders and numeric data.
  • Recognizes NaN, Inf, +Inf, and -Inf; empty numeric fields import as NaN.
  • Unsupported mixed text/numeric rows produce a descriptive parse error. Binary/image/audio/MAT import expansion should be handled by the dedicated import builtins as those domains mature.

Does RunMat run importdata on the GPU?

importdata does not launch provider kernels or participate in fusion.

GPU memory and residency

importdata is a host file-I/O source. It returns host tensors or structs and does not create GPU-resident arrays.

Examples

Import a plain numeric text matrix

A = importdata("values.txt")

Import CSV data with a header row

S = importdata("run.csv");
S.colheaders
S.data

Specify delimiter and header-line count

S = importdata("log.dat", '|', 2)

Using importdata with coding agents

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

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

FAQ

When does importdata return a struct?⌄

It returns a struct when header text, column headers, or row headers are present. Pure numeric files return a tensor.

How does delimiter detection work?⌄

RunMat samples non-empty lines and chooses a consistent comma, tab, semicolon, or pipe delimiter; otherwise it falls back to whitespace splitting.

Does this replace readmatrix?⌄

No. importdata preserves MATLAB's legacy convenience behavior. Prefer readmatrix or readtable for new code that needs explicit import options.

Related Io functions

Import

textscan

Net

accept · read · readline · tcpclient · tcpserver · write

Repl Fs

addpath · cd · copyfile · delete · dir · exist · fileattrib · fileparts · fullfile · genpath · getenv · getpref · isenv · isfile · isfolder · ispref · ls · matlabroot · memmapfile · 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

Tabular

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

Audio

audioinfo · audioread

Io

clc · diary · disp · display · format · input

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

Json

jsondecode · jsonencode

Mat

load · matfile · save

Http

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

Open-source implementation

Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how importdata is executed, line by line, in Rust.

  • View the source for importdata 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 importdata works
  • Does RunMat run importdata on the GPU?
  • GPU memory and residency
  • Examples
  • Import a plain numeric text matrix
  • Import CSV data with a header row
  • Specify delimiter and header-line count
  • Using importdata with coding agents
  • FAQ
  • Related Io functions
  • Import
  • Net
  • Repl Fs
  • Tabular
  • Audio
  • Io
  • Filetext
  • Archive
  • Hdf5
  • Json
  • Mat
  • Http
  • Open-source implementation
  • About RunMat