filesep

Returns the file separator of the platform.

Category: Programming > Files and Folders

Syntax

f = filesep

Returns '\' on Windows and '/' elsewhere.

Description

Use filesep when you glue path pieces together yourself, so that the code keeps working on other systems. For most cases fullfile is better because it also avoids doubled separators.

MatLivre runs on Windows, where the separator is the backslash, though / is accepted in file names as well.

Output arguments

f
A one-character vector.

Example

Joining with the separator

f = filesep
p = ['data' filesep 'run1']
Output
f = '\'
p = 'data\run1'

See also

fullfile pathsep fileparts filemarker