Manages current working directory and files that are opened in MATLAB editor (but not the workspace) for different projects.
Usage: PROJECTS(cmd, projectName)
PROJECTS('list') shows all stored projects. Arrow marks active project.
PROJECTS('active') returns the name of the active project
PROJECTS('show') shows information about the current project
PROJECTS('show', project_name) shows information about the project
PROJECTS('close') closes all opened files
PROJECTS('save') saves current working directory and editor state under the active project
PROJECTS('save', projectName) saves current working directory and editor state under the specified project name
PROJECTS('load') restores the project "default"
PROJECTS('load', projectName) restores the project with specified name
PROJECTS('open') is synonym for PROJECTS('load')
PROJECTS('rename', newName) renames the active project
PROJECTS('rename', projectName, newName) renames the project
PROJECTS('delete') deletes the active project
PROJECTS('delete', projectName) deletes the project with specified name
projects save myProject
projects load default
projects rename myProject myLibrary
All projects are stored in the %userpath%/projects.mat. This file with the empty "default" project is created at the first run of the script.
First project always has name "default".
MATLAB versions older than R2011a (7.12) are not supported.
I find this a very useful contribution. I use chrishechris' version - see below. Now that I've upgraded to 2016B (for Mac, anyway) it needs a small change at Line 60 - thus -
fpath = fullfile(fpath(1:end-1), 'projects.mat');
fpath = fullfile(fpath, 'projects.mat');
Thanks for this very helpful.
I've had a couple modification that I thought I'd share...
To fix the Variable output array "varargout" error, change this:
varargout = ;
varargout = cell(0,0);
Fixed version here (https://github.com/christhechris/matlab-projects/releases/tag/v1.1).
I also made some modifications that let me sync projects across multiple computer using Dropbox (including cross-platfrom). https://github.com/christhechris/matlab-projects/releases/tag/v2.
Worked fine in 2015a, but returns "Variable output array "varargout" must be a cell array.
Error in projects (line 49)
function varargout = projects(cmd, varargin)"
Very useful... Wondering about a couple of conceptual changes. I'm sure 99% of the folks who use this rename the default project to something that's more meaningful. When that project is "done", we'd like to be able to delete that project, but we can't because the code "thinks" that project #1 is default and therefor undeletable. How about changing the logic so that you can't delete the only project in the list? A quick look at the code says it's a bit more complicated than that, but it would make the package far more useful (at least in my opinion).
useful to me.
Hi, per isakson. Thank you for the bug report.
I updated the script (it should appear here shortly, or the new version is on github) - now it will call "userpath('reset')" if the userpath is empty.
My first try resultet in:
Subscript indices must either be real positive integers or logicals.
Error in projects (line 65)
projectsList(1).ActiveDir(end) = ;
The reason is that the function, userpath, returns empty on my system (R2012a).
Small bugfix: if userpath is empty - the script will reset it to the default value
Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.