rehash

Refreshes the program's cache of the folders on the path.

Category: Programming > Files and Folders

Syntax

rehash

Rescans the folders on the search path for function files.

Description

The program remembers which function files exist in each folder on the path. Files added or removed by another program may not be noticed until the next scan. rehash forces the scan so that the new function can be called by name. Files created with writelines or other functions of the session are normally seen already.

Example

Using a function file just created

writelines('function y = twice(x), y = 2*x; end', 'twice.m');
rehash
twice(21)
Output
ans = 42

See also

path addpath which exist