How do i create "projects"?

1 vue (au cours des 30 derniers jours)
Lockywolf
Lockywolf le 20 Avr 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

Réponses (2)

Walter Roberson
Walter Roberson le 20 Avr 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 le 21 Avr 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.

Catégories

En savoir plus sur Search Path dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by