Documentation

This is machine translation

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

genpath

Generate path string

Syntax

  • p = genpath
  • p = genpath(folderName)
    example

Description

p = genpath returns a path string, p, that includes all the folders and subfolders below matlabroot/toolbox, including empty subfolders.

example

p = genpath(folderName) returns a path string that includes folderName and multiple levels of subfolders below folderName. The path string does not include folders named private, folders that begin with the @ character (class folders), folders that begin with the + character (package folders), or subfolders within any of these.

Examples

collapse all

Add Folder and Subfolders to Search Path

Use genpath in conjunction with addpath to add a folder and its subfolders to the search path.

Generate a path that includes matlabroot/toolbox/images/colorspaces and all folders below it.

folderName = fullfile(matlabroot,'toolbox','images','colorspaces');
p = genpath(folderName);

Add the folder and its subfolders to the search path.

addpath(p)

Input Arguments

collapse all

folderName — Folder namestring

Folder name, specified as a string.

Example: 'c:/matlab/myfiles'

See Also

| |

Introduced before R2006a

Was this topic helpful?