Workspace and Variable Preferences

Workspace Preferences

Workspace preferences enable you to configure options for saving workspace variables to MATLAB® scripts. They also enable you to restrict the size of arrays on which you perform calculations and to specify if you want those calculations to include or ignore NaNs.

To open Workspace preferences, on the Home tab, in the Environment section, click Preferences. Select MATLAB > Workspace.

Threshold for writing variables to MATLAB script

Specify Maximum array size to limit the number of elements of arrays saved to a MATLAB script.

Specify Maximum struct/object nesting levels to limit the nesting level of structures, arrays, or objects saved to a MATLAB script.

Multidimensional array formatting

Specify how multidimensional arrays are formatted when saved to a MATLAB script.

To create a compact script, select Row vector with reshape (compactness and efficiency).

To retain array representation, select As 2-D pages (readability). The dimensions of a 2-D slice are integers that meet the following requirements:

  • They are positive.

  • They are less than or equal to the dimensions of the n-D array.

  • The second integer is greater than the first.

File formattingSet the character width at which text in the MATLAB script is wrapped by specifying Maximum characters per line
n element and smaller arrays show statistics

Limit the size of arrays for which the Workspace browser displays statistics to improve performance when MATLAB updates the statistical results in the Workspace browser.

For more information, see Statistical Calculations in the Workspace Browser.

Handling NaN values in calculations

Specify whether NaN values are included or excluded from calculations for the statistics displayed in the Workspace browser:

  • Use NaNs when calculating statistics

  • Ignore NaNs when calculating statistics

MATLAB array size limit

By default, MATLAB uses up to 100% of the size of RAM (not including virtual memory) of your computer to allocate memory for each MATLAB array. To change this limit to a smaller percentage, select the Limit the maximum array size to a percentage of RAM check box. Then move the slider to adjust the percentage of RAM.

To allow MATLAB to use both RAM and virtual memory when creating an array, clear the check box. If MATLAB attempts to allocate memory that exceeds the resources available on the computer, your system might become nonresponsive.

This limit applies to each array, not the limit for all MATLAB arrays.

Variables Preferences

When working in the Variables editor, Variables preferences enable you to specify the array formatting, cursor movement, and the decimal separator for exporting data using the system clipboard.

To open Variables preferences, on the Home tab, in the Environment section, click Preferences. Select MATLAB > Variables.


Select an option from the Default array format to specify the default array output format of numeric values displayed in the Variables editor. This format preference affects only how numbers display, not how MATLAB computes or saves them. For information on formatting options, see the reference page for the format function.


Specify where the cursor moves to after you type an element, and then press Enter:

  • To keep the cursor in the element where you typed, clear the Move selection after Enter check box.

  • To move the cursor to another element, select the Move selection after Enter check box. In the Direction field, specify how you want the cursor to move.

International number handling

In the Decimal separator for exporting numeric data via system clipboard field, specify the decimal separator for numbers you cut or copy from the Variables editor when you paste them into text files or other applications.

This preference has no effect on numeric data copied from and pasted into MATLAB. Within MATLAB, decimal separators are always periods.

Was this topic helpful?