How do i create "projects"?

2 visualizaciones (últimos 30 días)
Lockywolf
Lockywolf el 20 de Abr. de 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

Respuestas (2)

Walter Roberson
Walter Roberson el 20 de Abr. de 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 el 21 de Abr. de 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.

Categorías

Más información sobre Search Path en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by