restoredefaultpath

Resets the search path to its default folders.

Category: Programming > Files and Folders

Syntax

restoredefaultpath

Drops every folder added with addpath and keeps only the default ones.

Description

Use restoredefaultpath to undo a tangle of addpath calls or to rule out a shadowed function when debugging. Afterward, functions that lived only in added folders are no longer found, so call addpath again for the ones you need.

Example

Dropping an added folder

mkdir lib
writelines('function y = triple(x), y = 3*x; end', 'lib/triple.m');
addpath('lib')
exist('triple')
restoredefaultpath
exist('triple')
Output
ans = 2
ans = 0

See also

addpath rmpath path genpath