How do i create "projects"?
1 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(2 个)
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.
0 个评论
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.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Search Path 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!