This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


Delete MATLAB matrix


= MLDeleteMatrix(var_name)
MLDeleteMatrix var_name
out = MLDeleteMatrix(var_name)


= MLDeleteMatrix(var_name) deletes the named matrix from the MATLAB® workspace. Use this syntax when working directly in a worksheet.

MLDeleteMatrix var_name deletes the named matrix from the MATLAB workspace. Use this syntax in a VBA macro.

out = MLDeleteMatrix(var_name) lets you catch errors when executing MLDeleteMatrix in a VBA macro. If MLDeleteMatrix fails, then out is a string containing error code. Otherwise, out is 0.

Input Arguments


Name of MATLAB matrix to delete.

var_name in quotes directly specifies the matrix name. var_name without quotes specifies a worksheet cell address (or range name) that contains the matrix name.

Output Arguments


0 if the command succeeded. Otherwise, a string containing error code.


collapse all

Delete matrix A from the MATLAB workspace:


Introduced before R2006a