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

2 次查看(过去 30 天)
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.

采纳的回答

MathWorks Support Team
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.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Search Path 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by