Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Matlab saves copies of files with extension m~. What do they do & can I turn them off?

Tags:

file

matlab

Matlab keeps saving a copy of my m-files with the extension m~ in the same directory. This is pretty annoying since I always click on them and have to close them down. I am guessing it is some safety feature or some caching but is there anyway to turn them of so that they at least don't show up in the Matlab file browser box or act as hidden files or something?

like image 784
Reed Richards Avatar asked Mar 18 '11 11:03

Reed Richards


People also ask

What does MATLAB use files with the .m extension for?

An m-file, or script file, is a simple text file where you can place MATLAB commands. When the file is run, MATLAB reads the commands and executes them exactly as it would if you had typed each command sequentially at the MATLAB prompt.

How do I save an M file in MATLAB?

Save As--The Save file as dialog box opens, where you assign a name to the file and save it. By default, if you do not type an extension, MATLAB automatically assigns the . m extension to the filename.

What is the MATLAB file extension?

MATLAB® stores live scripts and functions using the Live Code file format in a file with a . mlx extension.

How do I save an M file in MATLAB online?

For example, to save a live script as a plain code file ( . m ), on the Live Editor tab, in the File section, select Save > Save As. In the dialog box that appears, select MATLAB Code files (UTF-8) (*. m) as the Save as type and click Save.


1 Answers

These are autosave files. You can modify autosaving in File->Preferences->Editor/Debugger->Autosave.

I wouldn't turn off the feature (it has come in very handy before), but I agree that having lots of .m~ files in the working directory is annoying. I usually set this to changing the extension to .asv, and to saving all autosaves in a single autosave directory.

like image 186
Jonas Avatar answered Sep 29 '22 13:09

Jonas