How do i create "projects"?

조회 수: 3 (최근 30일)
Lockywolf
Lockywolf 2012년 4월 20일
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

답변 (2개)

Walter Roberson
Walter Roberson 2012년 4월 20일
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 2012년 4월 21일
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.

카테고리

Help CenterFile Exchange에서 Search Path에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by