Documentation

This is machine translation

Translated by Microsoft
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.

pathsep

Search path separator for current platform

Syntax

c = pathsep

Description

example

c = pathsep returns the search path separator character for the current platform. The search path separator is the character that separates path names in the pathdef.m file, as returned by the path function. On Windows®, the character is a semicolon (;). On UNIX® the character is a colon (:). Use pathsep to work programmatically with the content of the search path file.

Examples

collapse all

Use genpath in conjunction with regexp and pathsep to get a list of individual folders within a path name.

Create a folder myfolder containing a subfolder mysubfolder.

mkdir myfolder;
cd myfolder;
mkdir mysubfolder;
cd ..

Generate a path name that includes myfolder and all folders below it.

p = genpath('myfolder')
p = 
'myfolder:myfolder/mysubfolder:'

Use the regexp function to split the path into individual folders.

s = regexp(p, pathsep, 'split')
s = 1x3 cell array
    {'myfolder'}    {'myfolder/mysubf...'}    {0x0 char}

Introduced before R2006a

Was this topic helpful?