- "This scenario works very well ..."
- You use one computer at a time
Matlab Path File Management
17 ビュー (過去 30 日間)
古いコメントを表示
I have been a Matlab user since 1998. Management of the "matlab path" has changed and improved over the years, but it is still not quite what I want.
I presently use Matlab R2015a on four machines simultaneously for my doctoral research. All of my research related m-files and mat-files are in a single cloud folder called "work" neatly organized into subfolders. The folder "work" and all of its subfolders are on the "matlab path" on all four installations of Matlab R2015a.
This scenario works very well for simultaneous changes to any m-files or mat-files within the cloud folder "work" or any of its subfolders. However, changes to subfolder names, the deletion of subfolders, and the creation of new subfolders is less than ideal. All four "matlab paths" need to be updated for this. The result is that I am discouraged from making any subfolder changes, and certain subfolders get overused until they absolutely have to be changed on all four machines. Note that this would still be inconvenient even if I were only using one machine.
What I would like to see in a future release of Matlab, is a "matlab path" management system whereby there is a default option to set a folder, say for example "work", such that all of its subfolders are automatically on the "matlab path" any time that such subfolders reside in the folder "work". In particular I want to see this remain the case when subfolders of the folder "work" are changed.
I am aware that this option could take more Matlab resources to maintain than the current "matlab path" management setup. For this reason it could be made into a user defined option, and I do actually suggest that it should be the default.
What are the reasons that an automatic "matlab path" folder management system such as this is currently not a part of Matlab?
4 件のコメント
per isakson
2015 年 6 月 16 日
編集済み: per isakson
2015 年 6 月 16 日
Thank you, now I understand better, but not fully.
I agree that's a bit awkward to rename a folders, which is on the Matlab path. Firstly, I cannot rename it in the Matlab Current Folder Window. I'm making the tests on R2013a.
I have to remove it from the path, rename it, add it to the path and finally save the path. With Windows Explorer I can rename it, but that confuses Matlab.
Deleting a folder on the path and then start Matlab results in 1) a warning and 2) Matlab automatically removes the folder from the current path.
However, Matlab doesn't save the current path and at next start the same warning is issued again. It seems, one has to save the path interactively.
"four machines all need to be updated individually by hand"   This is the issue I don't fully understand. If all machines start in the same folder, i.e. use the same "startup-folder", they will all at start automatically load the same path stored in h:\m\startup\pathdef.m (on my system). There should be no need to do that "individually by hand".
採用された回答
Image Analyst
2015 年 6 月 16 日
Why don't you just use genpath to put your work folder and all it's subfolders on the path? Put this line in your startup.m file and then it doesn't matter what you do to folders in your work folder - you can rename them, delete them, add new ones, whatever - it will update it every time you launch MATLAB.
addpath(genpath('D:/Matlab/work'));
savepath;
その他の回答 (1 件)
Jan
2015 年 6 月 14 日
編集済み: Jan
2015 年 6 月 14 日
I'm working with different projects in a lab with 12 computers and several colleagues, which are running different projects also. Some folders containing basic tools are shared between the projects, others are distinct.
Therefore we are using a dedicated tool to manage the paths for the computers, the users and the projects. This tool cares about the different Matlab versions also, e.g. it adds workarounds for modern Matlab features like the 2nd and 3rd input for find when Matlab 6.5 is used.
So if someone includes a new folder for a project, other users of the projects have to call
initialize ProjectName
only and the path is set automatically.
This allows to define further paths depending on the machine or user, e.g. if some user data are stored on a local machine: If you run the initialization on this machine, the path to the data is defined accoringly, while on other computers the network path is used.
This can be used as a cheap version management also. This allows for an easy direct comparison of the results:
initialize projectA v1 % includes "N:\MFiles\ProjectA\Base_v1;Tools_v1;Graphics_v1"
run_projectA
initialize projectA v2 % Removes all folders insider N_\MFiles\ProjectA
% includes "N:\MFiles\ProjectA\Base_v2;Tools_v2;Graphics_v1"
run_projectA
While the "Base" and "Tools" folder have been changed, the graphic output is the same in this example.
In a multi-user/project/computer environment such a method for the folder management is very useful - I would say obligatory. Then the pathdef.m file contains one user-defined folder only: The one of the project management system.
参考
カテゴリ
Help Center および File Exchange で Startup and Shutdown についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!