Desktop Tools and Development Environment Previous page   Next Page

Saving M-Files

After making changes to an M-file, you see an asterisk (*) next to the filename in the title bar of the Editor/Debugger. This indicates there are unsaved changes to the file.

To save the changes, use one of the Save commands in the File menu:

You cannot save a file while in debug mode. If you try to, MATLAB displays a dialog box asking if you want to exit debug mode and then save the file. While debugging, you can execute sections of an M-file even though there are unsaved changes--see Running Sections in M-Files That Have Unsaved Changes.

Autosave

As you make changes to a file in the Editor/Debugger, every five minutes the Editor/Debugger automatically saves a copy of the file to a file of the same name but with an .asv extension. The autosave copy is useful if you have system problems and lose changes made to your file. In that event, you can open the autosave version, filename.asv, and then save it as filename.m to use the last good version of filename. For example, if you edit filename.m and do not save it for five minutes, MATLAB saves the file including the unsaved changes, to filename.asv.

Use autosave preferences to turn the autosave feature off or on, to specify the number of minutes between automatic saves, and to specify the file extension and location for autosave files. For details, see Autosave Preferences for the Editor/Debugger in the online documentation."

If the file you are editing is in a read-only directory and the autosave preference for location is the source file directory, an autosave copy of the file is not made.

Deleting Autosave Files.   By default, autosave files are not automatically deleted when you delete the source file. To keep autosave to M-file relationships clear and current, it is a good practice when you rename or remove an M-file to delete or rename its corresponding autosave file.

There is a preference to Automatically delete autosave files. With this preference selected, when you close an M-file in the Editor/Debugger, MATLAB automatically deletes the corresponding autosave file.

Accessing Your Source Control System

If you use a source control system for M-files, you can access it from within the Editor/Debugger using File -> Source Control. For more information, see Source Control Interface.


Previous page  Opening a Selection in an M-File Running M-Files from the Editor/Debugger Next page

© 1994-2005 The MathWorks, Inc.