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

exist — Return the documented numeric code for a variable, file, folder, builtin, model, or class.

exist searches the active workspace and configured search path and returns a host double scalar code from 0 through 8. The optional documented searchType values are builtin, class, dir, file, and var.

Syntax

exist name
exist name searchType
typeID = exist(name)
typeID = exist(name, searchType)

Inputs

name
Type
StringScalar
Required
Yes
Description
Variable/function/file/class name to query.
type
Type
StringScalar
Required
Yes
Description
Documented query kind: builtin|class|dir|file|var.
NameTypeRequiredDefaultDescription
nameStringScalarYes—Variable/function/file/class name to query.
typeStringScalarYes—Documented query kind: builtin|class|dir|file|var.

Returns

typeID
Type
NumericScalar
Description
Existence code (0,1,2,3,4,5,6,7,8) following MATLAB semantics.
NameTypeDescription
typeIDNumericScalarExistence code (0,1,2,3,4,5,6,7,8) following MATLAB semantics.

Errors

RunMat:exist:TooManyInputs
When
More than two total input arguments are provided.
Message
exist: too many input arguments
RunMat:exist:InvalidName
When
Name input is not a character vector or string scalar/array scalar.
Message
exist: name must be a character vector or string scalar
RunMat:exist:InvalidTypeArgument
When
Type input is not a character vector or string scalar/array scalar.
Message
exist: type must be a character vector or string scalar
IdentifierWhenMessage
RunMat:exist:TooManyInputsMore than two total input arguments are provided.exist: too many input arguments
RunMat:exist:InvalidNameName input is not a character vector or string scalar/array scalar.exist: name must be a character vector or string scalar
RunMat:exist:InvalidTypeArgumentType input is not a character vector or string scalar/array scalar.exist: type must be a character vector or string scalar
RunMat:exist:InvalidTypeType input is not one of the supported exist query types.exist: invalid type. Type must be one of 'builtin', 'class', 'dir', 'file', or 'var'
RunMat:exist:TooManyOutputsMore than one output is requested.exist: too many output arguments

Queries and return codes

The documented return codes are 0 not found or inaccessible, 1 variable, 2 general file, 3 MEX file, 4 loaded or on-path Simulink model, 5 builtin, 6 P-code, 7 folder, and 8 class.

Without searchType, variables and builtins have highest precedence; folders then precede classes and files; remaining file kinds follow function precedence within search-path order.

exist(name,'file') searches files and folders and can therefore return 2, 3, 4, 6, 7, or 0.

name and documented searchType values are host string scalars or character vectors. Integer and logical inputs are inapplicable and reject without conversion.

RunMat supports additional selector aliases and specialized selectors for its own runtime. They are an explicit RunMat-only extension and reject in MATLAB compatibility mode.

exist(handleObject,'handle') with a nontext first argument is a separate RunMat-only extension.

Arbitrary unauthenticated HTTP and HTTPS URL lookup, JVM class discovery, and loaded Simulink runtime state remain environment-level gaps. Local and configured RunMat search-path lookup is supported.

Calling forms

name is a string scalar or character vector.

searchType is one of builtin, class, dir, file, or var.

The command form writes the result through normal command output behavior; the function form returns typeID.

One result is returned as a host double scalar. Requesting more than one output rejects before workspace or filesystem lookup; requesting zero outputs still performs the query.

Character rows may have trailing singleton dimensions. Genuine character pages, numeric names, and resident numeric inputs are not text and reject before provider access.

Lookup reads the active workspace, class registry, filesystem, and search path. These session-dependent reads form a fusion boundary and are not scheduled as distributed pure computations.

Examples

Check a workspace variable

alpha = 1;
typeID = exist('alpha','var');
assert(typeID == 1);

Check a folder through the file filter

typeID = exist('logs','file');
assert(typeID == 7);

Check a builtin

typeID = exist('sin','builtin');
assert(typeID == 5);

Distinguish files, P-code, and wildcard names

assert(exist('data.txt','file') == 2);
assert(exist('packed','file') == 6);
assert(exist('*.txt','file') == 0);

Using exist with coding agents

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

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

FAQ

What data type is typeID?⌄

It is a host double scalar whose value is an integer code. It is not typed-integer storage.

Do wildcard names work?⌄

No. Names containing wildcard characters do not perform a wildcard search and return 0.

Does RunMat support every MATLAB environment-backed code?⌄

Filesystem MEX, P-code, Simulink-extension, builtin, folder, file, and RunMat class discovery are represented. JVM discovery, loaded Simulink state, and arbitrary web URL lookup need broader environment infrastructure.

Related Io functions

Repl Fs

addpath · cd · copyfile · delete · dir · 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

Net

accept · read · readline · tcpclient · tcpserver · write

Tabular

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

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

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
  • Queries and return codes
  • Calling forms
  • Examples
  • Check a workspace variable
  • Check a folder through the file filter
  • Check a builtin
  • Distinguish files, P-code, and wildcard names
  • Using exist with coding agents
  • FAQ
  • Related Io functions
  • Repl Fs
  • Net
  • Tabular
  • Audio
  • Io
  • Data
  • Filetext
  • Archive
  • Hdf5
  • Import
  • Json
  • Mat
  • Http
  • About RunMat