MATLAB Function Reference    
rehash

Refresh function and file system path caches

Syntax

Description

rehash with no 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 (functions that have been called but not cleared in the current session) against their timestamps on disk. It clears loaded functions if the files on disk are newer. All of this normally happens each time MATLAB displays the Command Window prompt. Therefore, use rehash with no arguments only when you run an M-file that updates another M-file, and the calling file needs to reuse the updated version before it has finished running.

rehash path performs the same updates as rehash, but uses a different technique for detecting the files and directories that require updates. If you receive a warning during MATLAB startup notifying you that MATLAB could not tell if a directory has changed and you encounter problems with MATLAB using the most current versions of your M-files, run rehash path.

rehash toolbox updates all directories in $matlabroot/toolbox. Run this when you add or remove files in $matlabroot/toolbox during a session by some means other than MATLAB tools, like the Editor.

rehash pathreset performs the same updates as rehash path, and also ensures the known files and classes list follows precedence rules for shadowed functions.

rehash toolboxreset performs the same updates as rehash toolbox, and also ensures the known files and classes list follows precedence rules for shadowed functions.

rehash toolboxcache performs the same updates as rehash toolbox, and also updates the cache file. This is the equivalent of clicking the Update Toolbox Path Cache button in General Preferences.

See Also

addpath, clear, path, rmpath

Toolbox Path Caching in MATLAB Development Environment.


  registerevent (COM) release (COM)