From the help:
matproj.m--Saves and loads MATLAB "projects". A project consists of the MATLAB files that are currently open in the MATLAB Editor. Loading a project returns the MATLAB Editor to the state it was in when the project was saved, with the same MATLAB files open to the same lines, the working directory set to that of the loaded project and the MATLAB search path set back to its saved value.
I tend to be a little obsessive compulsive about having many windows open on my computer. This means I close figures, files, Internet Tabs, etc. that I am not using. For the purpose of closing editor files I have a little shortcut, CloseNoPrompt, that allows me to quickly and painlessly close all open MATLAB files.
%All Editor files; closeNoPrompt(matlab.desktop.editor.getAll);
matproj allows me to save the current state of my editor so that I can continue to shamelessly close my files but be able to get back to the same state at a later time. This is really useful in day-to-day work where I may need many files open to work on a task but then will not need them for a few days while working on something else. Since matproj also stores the location of the cursor in the file, you can get right back to exactly where you want to be!
I've been trying to break matproj by coming up with edge cases where it might fail. So far, it has outsmarted me every time. Here are a few of the other features that I've run into:
- Works with *.txt, and *.c files as well.
- If a file that is part of a saved project is deleted, it warns that this file is missing and opens the rest of the project.
- If a file is not saved, it stops instead of closing those files.
- Errors if you try to open a file that is not a project.
My main suggestion to improve this file is to package it into a MATLAB App. This would make it easy to access from the Apps tab. Of course you could add it as a shortcut too.
Okay, I've already turned it into an app and realized it comes with another very nice benefit: The app is now installed in a specific apps directory. Whenever a project is saved or loaded, this directory is the one opened, so the only available *.mat files are ones relevant to this app. This means I don't need to filter through any other ones that may be in the directory.
Another suggestion would be an option to not close all active files when loading a project. Right now, all current editor files are closed when a saved project is loaded. Although this behavior is expected, it would be nice to be able to keep the current files open as well. It would also make it easy to concatenate projects :)
Do you have a use for MATLAB Projects?
Get the MATLAB code
Published with MATLAB® R2013a
Comments are closed.