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

delete — Remove files or invalidate handles.

delete(filename) removes files without a MATLAB-facing output; delete(obj) invalidates a handle or listener. The ResolveSymbolicLinks control selects link or target deletion.

Syntax

delete(filename)
delete(filename1, filename2, ...)
delete(___, ResolveSymbolicLinks=tf)

Inputs

filename
Type
Any
Required
Yes
Description
Filename/pattern string, string array, char matrix, cell array of path strings, or handle input.
filename1
Type
Any
Required
Yes
Description
First filename/pattern/handle input.
filenameN
Type
Any
Required
Variadic
Description
Additional filename/pattern/handle inputs.
filename
Type
Any
Required
Yes
Description
Filename, filename collection, or wildcard pattern.
ResolveSymbolicLinks
Type
StringScalar
Required
Yes
Description
Name of the symbolic-link resolution option.
tf
Type
Any
Required
Yes
Default
false
Description
Scalar logical or numeric zero/one selecting link-target deletion.
NameTypeRequiredDefaultDescription
filenameAnyYes—Filename/pattern string, string array, char matrix, cell array of path strings, or handle input.
filename1AnyYes—First filename/pattern/handle input.
filenameNAnyVariadic—Additional filename/pattern/handle inputs.
filenameAnyYes—Filename, filename collection, or wildcard pattern.
ResolveSymbolicLinksStringScalarYes—Name of the symbolic-link resolution option.
tfAnyYesfalseScalar logical or numeric zero/one selecting link-target deletion.

Errors

RunMat:delete:InvalidInput
When
Input arguments are missing or contain unsupported filename value types.
Message
delete: invalid input
RunMat:delete:InvalidHandle
When
Handle deletion inputs are mixed with filename inputs or contain unsupported handle values.
Message
delete: invalid handle input
RunMat:delete:EmptyFilename
When
A filename input is empty after trimming.
Message
delete: filename cannot be empty
IdentifierWhenMessage
RunMat:delete:InvalidInputInput arguments are missing or contain unsupported filename value types.delete: invalid input
RunMat:delete:InvalidHandleHandle deletion inputs are mixed with filename inputs or contain unsupported handle values.delete: invalid handle input
RunMat:delete:EmptyFilenameA filename input is empty after trimming.delete: filename cannot be empty
RunMat:delete:InvalidPatternWildcard pattern parsing or structure validation fails.delete: invalid wildcard pattern
RunMat:DELETE:FileNotFoundTarget path does not exist or pattern matches no files.delete: file not found
RunMat:delete:DirectoriesTarget path is a directory instead of a file.delete: cannot delete directories
RunMat:DELETE:PermissionDeniedUnderlying filesystem operation fails while deleting files.delete: filesystem deletion failed
RunMat:parallel:RuntimeContextUnavailablePool deletion is requested without an active runtime context.delete: no active runtime context

Files and patterns

delete(filename) removes one file without a MATLAB-facing output. Filenames may be text scalars, string arrays, character matrices, or cells of path text. Each target is processed in order; a later failure does not restore earlier deletions.

Patterns accept * and ? and must match existing files. Directories are rejected; use rmdir for a folder. Direct paths and wildcard enumeration use the same captured filesystem provider and working directory. A leading ~ expands to the user's home directory; for example, delete('~/runmat/build/*.o') cleans matching build artifacts when that directory exists.

An empty string scalar or empty character row is invalid. Empty string arrays and cells perform no deletions.

Links and handles

delete(filename, 'ResolveSymbolicLinks', tf) accepts logical tf or exact numeric zero/one, including every built-in integer class. False removes the link itself; true removes its resolved file or empty-folder target and leaves the link.

delete(obj) invalidates handle objects and event listeners without filesystem access. A handle cannot be mixed with filename targets, and ResolveSymbolicLinks does not apply to handles. A pool is accepted only as the sole argument and closes through the active parallel runtime.

Execution

Filesystem mutation and handle callbacks are host effects. Filename inputs must contain host text; resident numeric values are rejected without downloading them. Handle properties and listener callbacks are not filename inputs: deletion retains their existing payloads and residency. There is no acceleration kernel or fusion route for deletion itself.

Failures retain their diagnostic identifier. A missing path or unmatched pattern raises RunMat:DELETE:FileNotFound; a directory raises RunMat:DELETE:Directories; filesystem failures raise RunMat:DELETE:PermissionDenied.

Examples

Delete a temporary file

fname = 'scratch.txt';
fid = fopen(fname, 'w');
fclose(fid);
delete(fname);
assert(exist(fname, 'file') == 0);

Remove matching log files

logs = ["log-01.txt", "log-02.txt"];
for i = 1:numel(logs)
    fid = fopen(logs(i), 'w');
    fclose(fid);
end
delete('log-*.txt');
assert(exist('log-01.txt', 'file') == 0);
assert(exist('log-02.txt', 'file') == 0);

Delete a string array of paths

files = ["stageA.dat", "stageB.dat"];
for i = 1:numel(files)
    fid = fopen(files(i), 'w');
    fclose(fid);
end
delete(files);
assert(exist('stageA.dat', 'file') == 0);
assert(exist('stageB.dat', 'file') == 0);

Delete filenames in a character matrix

names = char('stage1.tmp', 'stage2.tmp');
for row = 1:size(names, 1)
    fname = strtrim(names(row, :));
    fid = fopen(fname, 'w');
    fclose(fid);
end
delete(names);
assert(exist('stage1.tmp', 'file') == 0);
assert(exist('stage2.tmp', 'file') == 0);

Handle a missing file

caught = false;
try
    delete('missing-file.txt');
catch err
    caught = strcmp(err.identifier, 'RunMat:DELETE:FileNotFound');
end
assert(caught);

Invalidate a graphics handle

fig = figure;
delete(fig);
tf = isvalid(fig);
assert(~tf);

Expected output:

tf = 0

Using delete with coding agents

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

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

FAQ

What message IDs does delete produce?⌄

Missing files use RunMat:DELETE:FileNotFound; directories use RunMat:DELETE:Directories; invalid wildcard patterns use RunMat:DELETE:InvalidPattern; filesystem failures use RunMat:DELETE:PermissionDenied; invalid handle inputs use RunMat:DELETE:InvalidHandle.

Can I delete folders?⌄

No. Use rmdir; delete raises RunMat:DELETE:Directories for a directory.

Can I delete several files?⌄

Yes. Pass several path arguments, a string array, a cell of path text, or a character matrix. Targets are processed sequentially.

How do wildcard patterns work?⌄

* and ? match paths relative to the captured filesystem provider's working directory unless the path is absolute. An unmatched pattern raises RunMat:DELETE:FileNotFound.

Do empty arrays raise errors?⌄

Empty string arrays and cells do nothing; an empty string scalar is invalid.

Are resident arguments downloaded?⌄

No. Resident numeric filename inputs are rejected before provider access, including within cells. Handles and listeners may retain resident properties or callback captures; deletion does not download those payloads.

Does delete preserve symbolic links?⌄

By default it removes the link itself. Set ResolveSymbolicLinks to true or exact one to remove its resolved target instead.

Can I inspect failures?⌄

Use try/catch and inspect the exception's identifier and message.

Related Io functions

Repl Fs

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

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
  • Errors
  • Files and patterns
  • Links and handles
  • Execution
  • Examples
  • Delete a temporary file
  • Remove matching log files
  • Delete a string array of paths
  • Delete filenames in a character matrix
  • Handle a missing file
  • Invalidate a graphics handle
  • Using delete with coding agents
  • FAQ
  • Related Io functions
  • Repl Fs
  • Net
  • Tabular
  • Audio
  • Io
  • Data
  • Filetext
  • Archive
  • Hdf5
  • Import
  • Json
  • Mat
  • Http
  • About RunMat