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.

Set Command History Preferences

You can exclude statements from the command history and specify how many commands to save to the command history file, History.xml. MATLAB® uses the command history file for both the Command History window and statement recall in the Command Window.

Note

When you exclude statements from the command history file, you cannot recall them in the Command Window, nor can you view them in the Command History window.

You can also change the way you search for previously executed statements in the command history. Select from different search text matching options and change the way results are displayed in the Command History window.

To set Command History preferences, on the Home tab, in the Environment section, click Preferences. Select MATLAB > Command History, and then adjust the preference options as described in this table:

OptionUsage
Save

Select Save exit/quit commands to save exit and quit commands in the command history.

Select Save consecutive duplicate commands to save consecutive executions of the same statement in the command history.

  • With this option selected, if you run magic(5) two times in a row, the entries for magic(5) appear on separate lines in the command history.

  • With this option cleared, the command history retains only one entry for magic(5) and displays a tally of consecutive executions to the left.

Select Don't save history file to prevent saving the command history across sessions. This option is useful when multiple users share the same machine. For example, the option prevents each user from viewing statements others have run.

Any entries predating the current session remain unless you first delete entries from the Command History window.

Save last n commands specifies the number of commands to save.
Match

Select Match anywhere to retrieve statements that contain the search text in any location.

Select Match beginning to retrieve statements that begin with the search text. This option is selected by default.

Select Match case to retrieve statements that match the case of the search text.
Select Filter matches to display only statements that match the search text. Clear Filter matches to display all previously executed statements and highlight the statements that match the search text.
ShowSelect Show match toolbar to display a search toolbar at the top of the Command History window. Search for previously executed statements using the search field and change Match preferences using the provided buttons.
Select Show match locations to display yellow markers to the right of the scroll bar in the Command History window that indicate the location of matches throughout the command history.
Select Show execution time to display an approximate execution time to the right of each statement. Times display for any statements that takes longer than 0.1 seconds to execute.
Favorite Commands

Select Don't show to disable showing favorite commands in the Command History window.

Select Show default category to only show the default Favorite Commands category in the Command History window.

Select Show all categories to show all the favorite commands categories in the Command History window.

Change the Command History Date Format

MATLAB uses your operating system's short date format to display dates in the Command History window. To change the date format, for instance from MM/DD/YYYY to DD/MM/YYYY:

  1. Change the short date format for your operating system as described in its documentation.

  2. Restart MATLAB.

    Note

    Clearing the command history deletes all entries from the Command History window. You can no longer recall those entries in the Command Window.

See Also