Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I update the MATLAB path?

Tags:

path

matlab

Sometimes when I add a new file to my path, I have to restart MATLAB or it won't be detected. There must be an other way to this!

like image 303
Lucas Avatar asked Sep 17 '09 09:09

Lucas


People also ask

How do I change the current path in MATLAB?

oldFolder = cd( newFolder ) returns the existing current folder to oldFolder , and then it changes the current folder to newFolder .

How do I set the path of a file in MATLAB?

Absolute and Relative Path Names MATLAB always accepts absolute path names (also called full path names), such as I:/Documents/My_Files or /users/myuserid/Homework/myfile. m . An absolute path name can start with any of the following: UNC path '\\' .

How do I assign a path to a folder in MATLAB?

To open the Set Path dialog box, on the Home tab, in the Environment section, click Set Path. You can also use the addpath function to add multiple folders to the search path.


2 Answers

I have experienced similar problems (Matlab does not notice it when I change a file). Unfortunately, I have no idea what causes it or how to solve it. I usually find that CLEAR ALL solves the problem, but be aware that it clears all variables in the work space. Some 'REHASH' command (e.g., REHASH TOOLBOXRESET) may also be useful.

I'd love to see a better answer; all documentation that I came across seems to indicate that this cannot happen.

like image 68
Jitse Niesen Avatar answered Sep 27 '22 22:09

Jitse Niesen


Perhaps this is a problem with Matlab caching certain files at startup to improve performance. This happens with files in certain directories.

From Matlab help for path command:

Note (...) Also note that locations of files in the matlabroot/toolbox directory tree are loaded and cached in memory at the beginning of each MATLAB session to improve performance. If you save files to matlabroot/toolbox directories using an external editor or add or remove files from these directories using file system operations, run rehash toolbox before you use the files in the current session. If you make changes to existing files in matlabroot/toolbox directories using an external editor, run clear functionname before you use the files in the current session. For more information, see the rehash reference page or the Toolbox Path Caching topic in the MATLAB Desktop Tools and Development Environment documentation

like image 33
groovingandi Avatar answered Sep 27 '22 22:09

groovingandi