Main Content

Workspace Panel

Interactively manage workspace contents

Description

The Workspace panel enables you to view and interactively manage the contents of the MATLAB® workspace. Using this tool, you can:

  • View the name, value, size, class, and other statistics for each variable in the workspace.

  • Interactively rename a variable in the workspace.

  • Interactively edit the value of a variable.

Workspace panel

Open the Workspace Panel

  • MATLAB sidebar: To show or hide the Workspace panel, click its icon on the sidebar. To open the Workspace panel if its icon is not on a sidebar, click the Open more panels button and select Workspace.

  • MATLAB command prompt: Enter workspace.

  • MATLAB Toolstrip: On the Home tab, in the Environment section, click Layout. Then, select Workspace.

Examples

expand all

You can interactively rename a variable and change its value using the Workspace panel.

To rename a variable, click its name and enter a new name. For example, change the name of a variable in the Workspace panel.

Edit field for an entry in the Name column in the Workspace panel

To edit the value of a scalar or vector variable, click its value, make changes, and press Enter. For example, change the second element of a vector variable in the Workspace panel.

Edit field for an entry in the Value column in the Workspace panel

To view and edit the values in a variable that shows its size rather than values in the Value column, such as a table, open it in the Variables editor by double-clicking the variable in the Workspace panel.

You can save your workspace variables to a MAT file and clear the workspace. Then, reload the variables from the saved file.

To save all variables in the workspace to a MAT file, right-click the Workspace panel and select Save Workspace in the context menu. Then, specify the filename and location. Alternatively, to save only a subset of variables in the current workspace, select the variables to save. Then, right-click the selection and select Save Selection in the context menu.

Next, to clear the workspace, right-click the Workspace panel and select Clear Workspace in the context menu.

Then, reload the variables that you saved. On the Home tab, in the File section, click Open and select the MAT file.

You can interactively duplicate or delete variables using the Workspace panel.

To duplicate selected variables, right-click the selection, and then select Duplicate.

To delete selected variables from the workspace, right-click the selection, and then select Delete. To delete all variables from the workspace, right-click the Workspace panel, and then select Clear Workspace. Alternatively, you can use the clear function.

You can display descriptive statistics for each variable as columns in the Workspace panel.

To display descriptive statistics for your variables, right-click the header of any column in the Workspace panel and select the statistics to display. MATLAB computes these statistics using functions such as min, max, and mean, and updates the results automatically when you update variables in the workspace. For example, display the minimum, maximum, and mean for each variable.

Tip

To improve performance, show only the statistics of interest to you. You can also exclude large arrays from statistical calculations. For more information, see Modify Workspace and Variables Settings.

Name, Value, Size, Class, Min, Max, and Mean are selected in a list of check boxes.

The Workspace panel automatically updates to display the selected statistics.

The Workspace panel displays the name, value, size, class, minimum, maximum, and mean for each variable.

If your data includes missing values, you can specify whether the Workspace panel includes or ignores the missing values when computing statistics. For more information, see Modify Workspace and Variables Settings.

You can interactively create a plot to visualize variables using the Workspace panel.

To visualize your data, select variables in the Workspace panel. Then, on the Plots tab, select a plot from the gallery of plot types. For example, create a scatter plot for variables x and y.

The Workspace panel displays vectors x and y, and a figure displays a scatter plot of x and y.

Programmatic Use

expand all

workspace displays the Workspace panel. If the Workspace panel is already open, MATLAB selects the tool.

Tips

  • When editing strings in the Workspace panel, you must use double quotes to surround the string value.

  • By default, the Workspace panel displays the base workspace. You also can view function workspaces if MATLAB is in debug mode. For more information, see Base and Function Workspaces.

Version History

Introduced before R2006a

expand all