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

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

NameTypeRequiredDefaultDescription
nameStringScalarYes—Variable/function/file/class name to query.
typeStringScalarYes—Documented query kind: builtin|class|dir|file|var.

Returns

NameTypeDescription
typeIDNumericScalarExistence code (0,1,2,3,4,5,6,7,8) following MATLAB semantics.

Errors

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'

How exist works

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

GPU memory and residency

No resident path. exist validates host text and performs workspace/filesystem lookup on the CPU.

Examples

Check a workspace variable

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

Expected output:

typeID = 1

Check a folder through the file filter

mkdir('logs');
typeID = exist('logs','file')

Expected output:

typeID = 7

Check a builtin

typeID = exist('sin','builtin')

Expected output:

typeID = 5

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

Net

accept · read · readline · tcpclient · tcpserver · write

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

Import

importdata · textscan

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

  • View the source for exist 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 exist works
  • GPU memory and residency
  • Examples
  • Check a workspace variable
  • Check a folder through the file filter
  • Check a builtin
  • Using exist with coding agents
  • FAQ
  • Related Io functions
  • Repl Fs
  • Net
  • Tabular
  • Audio
  • Io
  • Filetext
  • Archive
  • Hdf5
  • Import
  • Json
  • Mat
  • Http
  • Open-source implementation
  • About RunMat