# Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

# path

View or change search path

## Syntax

``path``
``path(newpath)``
``path(oldpath,newfolder)``
``path(newfolder,oldpath)``
``p = path(___)``

## Description

example

``path` displays the MATLAB® search path, which is stored in `pathdef.m`.`

example

````path(newpath)` changes the search path to `newpath`.```

example

````path(oldpath,newfolder)` adds the folder `newfolder` to the end of the search path. If `newfolder` is already on the search path, then `path(oldpath,newfolder)` moves `newfolder` to the end of the search path. To add multiple folders, use the `addpath` function.```

example

````path(newfolder,oldpath)` adds the folder `newfolder` to the beginning of the search path. If `newfolder` is already on the search path, then `path(oldpath,newfolder)` moves `newfolder` to the beginning of the search path.```
````p = path(___)` returns the MATLAB search path as a character vector. You can use this syntax with any of the input argument combinations in the previous syntaxes.```

## Examples

collapse all

Suppose you have MATLAB R2017a installed. Display the search path.

`path`
``` MATLABPATH C:\Program Files\MATLAB\R2017a\toolbox\matlab\datafun C:\Program Files\MATLAB\R2017a\toolbox\matlab\datatypes C:\Program Files\MATLAB\R2017a\toolbox\matlab\elfun C:\Program Files\MATLAB\R2017a\toolbox\matlab\elmat C:\Program Files\MATLAB\R2017a\toolbox\matlab\funfun C:\Program Files\MATLAB\R2017a\toolbox\matlab\general C:\Program Files\MATLAB\R2017a\toolbox\matlab\iofun C:\Program Files\MATLAB\R2017a\toolbox\matlab\lang C:\Program Files\MATLAB\R2017a\toolbox\matlab\matfun ...```

Add the folder `c:\tools\goodstuff` to the bottom of the search path on a Microsoft® Windows® system.

```oldpath = path; path(oldpath,'c:\tools\goodstuff') ```

Add the folder `/home/tools/goodstuff` to the beginning of the search path on a UNIX® system.

```oldpath = path; path('/home/tools/goodstuff',oldpath) ```

Temporarily add the folder `my_files` to the search path and then run `my_function` in `my_files`.

```oldpath = path; path(oldpath,'my_files') my_function```

Restore the previous search path.

`path(oldpath)`

## Input Arguments

collapse all

New MATLAB search path, specified as a character array.

Existing MATLAB search path, specified as a character array returned by the `path` command.

New folder to add to the MATLAB search path, specified as a character vector.

## Alternative Functionality

As an alternative to the `path` function, use the Set Path dialog box. To open the Set Path dialog box, on the Home tab, in the Environment section, click .

You can also use the `addpath` function to add multiple folders to the search path.

## See Also

### Topics

#### Introduced before R2006a

Was this topic helpful?

#### The Manager's Guide to Solving the Big Data Conundrum

Download white paper