How do i create "projects"?

3 Ansichten (letzte 30 Tage)
Lockywolf
Lockywolf am 20 Apr. 2012
I am writing something like an application in Matlab.
What annoys me most is the need to click through the directory tree in "current folder" to the root of my working dir, add all the necessary folders to matlab path manually every time I launch matlab.
Is there a way to keep all project properties at one place?
Directories, properties, launch configurations, etc...
Something like "Open Project" in Eclipse

Antworten (2)

Walter Roberson
Walter Roberson am 20 Apr. 2012
You can use pathtool to save your path.
pathtool uses savepath which writes to pathdef.m . You can create simple scripts to copy a file overtop of pathdef.m; and then to use path() on the path list returned by executing pathdef to activate the new path in the current session.

Darik
Darik am 21 Apr. 2012
I think Matlab is definitely lacking in this arena. I almost never save application paths in Matlab, it gets really annoying once you start working with multiple versions of your application.
What works for me is having the main application initialization function do something like
function init_my_app
path = fileparts(which(mfilename));
addpath(genpath(path))
Which means that anything in the same folder as init_my_app.m, or in subfolders, gets added to the path during initialization, but that path doesn't carry over to your next Matlab session. You could do a similar thing in function close_my_app using rmpath to remove the application folder hierarchy from the path as well, so it's only on the path while the application is running.

Kategorien

Mehr zu Search Path finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by