What Is a .asv File?
MATLAB crashed and left a .asv file next to your script. It is an autosave backup of your .m code. Here is how to turn it back into a working .m file before it disappears.
Recover it now (before you reopen the editor)
A .asv file is MATLAB's autosave backup of a script. If analysis.m was open when MATLAB crashed, you will find analysis.asv in the same folder. To get your code back: 1. In MATLAB, open the .asv file directly (File → Open, change the filter to All Files, pick analysis.asv). 2. Check that the code is the version you want. 3. Save As analysis.m. That is your recovered script.
What a .asv file is
By default MATLAB saves a backup copy of any modified file every few minutes with the .asv extension ("auto-save"). For filename.m the backup is filename.asv, written to the same directory as the original. It holds the last autosaved state of your code, so it is your safety net when the editor closes unexpectedly.
Where to find it
Look in the same folder as the original .m file first. If it is not there, MATLAB may be writing backups elsewhere: go to Home → Preferences → Editor/Debugger → Backup Files and check the Location setting (it can be set to a single directory).
Why it may already be gone
There is a preference, "Automatically delete autosave files when closing the file". If that box is ticked, MATLAB removes the .asv as soon as you close the editor cleanly — so recover it before you close or reopen anything. If MATLAB crashed (did not close cleanly) the .asv usually survives.
Is it safe to delete?
Yes, once you have saved your current work. The .asv is only a stale backup of code you already have. Deleting it does not affect your .m file. To stop MATLAB creating them, turn off Save untitled changes/autosave under the same Backup Files preference pane.
Open it without MATLAB
A .asv is plain text (your code). In a pinch you can open it in Notepad, VS Code, or any text editor to copy the code out — useful if you are on a machine without MATLAB and just need to rescue the script.
FAQ
What is a .asv file?
It is MATLAB's autosave backup of an .m script. MATLAB writes filename.asv next to filename.m every few minutes so you can recover code if the editor closes unexpectedly.
How do I open a .asv file?
Open it in MATLAB via File then Open (set the filter to All Files), confirm the code, and Save As a .m file. It is plain text, so any text editor can also read it.
How do I recover my MATLAB code from a .asv file?
Open the .asv in MATLAB and immediately save it as filename.m. Do this before closing or reopening the original file, because a preference can auto-delete autosave files on close.
Where are MATLAB .asv files stored?
By default in the same folder as the original .m file. If not there, check Home > Preferences > Editor/Debugger > Backup Files for a custom Location.
Is it safe to delete a .asv file?
Yes, once your current work is saved. It is only a stale backup copy of your code and deleting it does not affect the .m file.
Why is there no .asv file after my crash?
Either autosave/backup was turned off in the Editor/Debugger preferences, or the file was auto-deleted because MATLAB closed cleanly before the crash was noticed.
Other file types explained
- Recover an Unsaved Notepad++ File After a Crash
- Vim: Swap File Already Exists — Recover, Edit, or Delete?
- What Is a .ldb File? (Access Lock File That Will Not Delete)
- What Is a .dwl / .dwl2 File? (AutoCAD Lock File You Can Delete)
- Convert .crdownload to MP4 — How to Play an Incomplete Video
- Firefox Download Stuck at 100% — How to Fix the .part File
- Vim E325: ATTENTION — Swap File Error Explained & Fixed
- Chrome Download Stuck or Not Finishing — How to Fix It