Today I am going to talk a little about code development and appropriate hygiene that goes with it. Why? Well, have you ever ended up with a really sick feeling after spending hours on something, only to realize that it's been deleted? It's happened to me, but never again!
MATLAB currently allows you to make backups of your code, and you can control some aspects of that.
Here you can see my preferences. I choose to:
- allow frequent backups of open files
- save these with an alternate extension
- delete them when I quit MATLAB so I don't litter my file system with these backups
- place them in a central location rather than in the same folder as the code I am working on
You might want to choose different options suitable to your style of coding.
So, that's one way of working and using a bit of a safety net. You can also use some method of source code control from within MATLAB. Out of the box you can use SVN (Subversion) or GIT. If you choose this route, you don't even have to worry about pesky *.asv files lying around. Instead, you make some code changes and commit them to your system of choice. In these systems, you can always go back to prior versions. And so you don't risk causing permanent damage - generally a good idea.
How do you back up your work in MATLAB? With autosaved files? With source code control? Something else?