How to Set Path in Matlab?

不羁岁月 提交于 2019-11-26 18:36:01

问题


I wrote some codes for my project in Matlab. These codes consists of some functions and a main run file which are all scripted separately and kept in a folder. When I want to run the project I must set the Matlab path to this folder and then run the main file.

Now, I want to use another toolbox in my project which is developed by a third party. As I said, I want to use this toolbox in my own project, but I can only set the Matlab path to one of these directories. I was thinking if there is a way to add this toolbox to main path of Matlab so that it can be run like other predefined functions of Matlab like fmincon.


回答1:


In case of the toolbox I'd add it to the main search path of Matlab. You can do this with the Set Path in the main panel:

Click Add with Subfolders and choose the toolbox.

For your project, I would add the folder to your main function simply by using addpath. This option is temporary! If your folder contains a set of functions you always use, you can also add it permanently as above with Set Path. But be aware to pass this folder to others, if they want to use your project.



来源:https://stackoverflow.com/questions/29193897/how-to-set-path-in-matlab

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!