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
.
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.