| MATLAB® | ![]() |
| On this page… |
|---|
Using Command History preferences, you can choose to exclude statements from the command history file, history.m, and specify how often to save it. The command history file is used for both the Command History window and statement recall in the Command Window.
To set preferences for the command history file, select File > Preferences, and then select Command History in the Preferences dialog box.
Specify the types of statements to exclude from the command history file. Note that when you exclude statements from the command history file, you cannot recall them in the Command Window as described in Recalling Previous Lines, nor can you view them in the Command History window.
Select the check box to save exit and quit commands in the command history file.
Select the check box if you want consecutive executions of the same statement to be saved to the command history file.
For example, with this option selected, run magic(5), and then run magic(5) again. The command history file saves two consecutive entries for magic(5). With this option cleared, for the same example, the command history file saves only one entry for magic(5). If you then run magic(10), the command history file saves both entries, magic(5) followed by magic(10).
Use Saving preferences to specify how often to automatically save the command history file during a session of running the MATLAB® software. By default, MATLAB saves the history after every statement. This allows you to more easily recover your state in the event of an abnormal termination, because you can reconstruct it using the history.
Select this option to save the command history file when you end the session of MATLAB. If the session does not end via a normal termination, that is, via the exit or quit functions, File > Exit MATLAB, or the MATLAB desktop Close box, the history file is not saved for that session.
Select this option to save the command history file after n statements are added to the file. For example, when you select the option and set n to 10, after every 10 statements are added, the history file is automatically saved. Use this option instead of Save History File on Quit if you don't want to risk losing entries to the saved history because of an abnormal termination, such as a power failure.
Select this option if you do not want to save the command history file. This feature is useful when multiple users share the same machine and do not want other users to view the statements they have run.
Note that any entries already in the history.m file remain. Prior to setting this preference, you might want to remove any existing entries. Follow the instructions in Deleting Entries from the Command History Window.
Additional preferences that relate to the Command History:
![]() | Command History Window | Getting Help in MATLAB® Software | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |