Why are my custom defined functions sometimes not found inspite of adding them to path using the ADDPATH command?

2 views (last 30 days)
I have custom defined functions which I call multiple times from the MATLAB code. I use ADDPATH command before I use then, such that the MATLAB knows where to find them. But, on some instances when they are called multiple times, MATLAB does not find them on path.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 20 Jul 2009
Use the REHASH command after you execute ADDPATH for custom defined functions.
REHASH with no input arguments updates the MATLAB list of known files and classes for directories on the search path that are not in matlabroot/toolbox. It compares the timestamps for loaded functions against their timestamps on disk. It also clears loaded functions if the files on disk are newer.
Use REHASH with no input arguments when you run a MATLAB file that updates a second MATLAB file, and the calling file needs to reuse the updated version of the second MATLAB file before the calling file has finished running.

More Answers (0)

Categories

Find more on Search Path in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!