This little function allows you to save your data to a mat-file without worrying about accidentally overwriting a previous mat file by the same name. If a mat-file by the specified name (e.g. 'example.mat') already exists, this file is backed-up as e.g. 'example_backup_000.mat' before overwriting 'example.mat'. Every time another overwrite is attempted, the backup counter is incremented.
Cite As
Dennis (2026). safesave (https://www.mathworks.com/matlabcentral/fileexchange/34773-safesave), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Created with
R2009b
Compatible with any release
Platform Compatibility
Windows macOS LinuxCategories
Find more on Workspace Variables and MAT Files in Help Center and MATLAB Answers
Tags
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
| Version | Published | Release Notes | |
|---|---|---|---|
| 1.0.0.0 |
