# clear

## Purpose

Remove items from memory.

## Synopsis

    clear
    clear name
    clear name1 name2 name3\xc9
    clear functions
    clear variables
    clear mex
    clear global
    clear all

## Description

Executing `clear`, by itself, clears all variables from the workspace.

`clear` `name` removes just the variable or function `name` from the workspace. Both M-file functions and MEX-file functions can be cleared this way. `name` can be either a variable name or a function name.

`clear` `name1 name2 name3` removes `name1`, `name2`, and `name3` from the workspace.

`clear` `functions` clears all the currently compiled M-functions from memory.

`clear` `variables` clears all variables from the workspace.

`clear` `mex` clears all MEX-files from memory.

`clear` `global` clears all global variables.

`clear` `all` removes all variables, functions, and MEX-files from memory. It leaves MATLAB's workspace empty, as if MATLAB were just invoked.

If `name` is global, `clear` `name` removes `name` from the current workspace, but leaves it accessible to any functions declaring it global. `clear global` `name` completely removes the global variable `name`. `clear global` removes all global variables.

## See Also

    pack

(c) Copyright 1994 by The MathWorks, Inc.