en fr

Disponible uniquement en anglais

Sysquake Pro – Table of Contents

Sysquake – Table of Contents

Sysquake for LaTeX – Table of Contents

Path Manipulation Functions

fileparts

File path splitting into directory, filename and extension.

Syntax

(dir, filename, ext) = fileparts(path)

Description

fileparts(path) splits string path into the directory (initial part until the last file separator), the filename without extension (substring after the last file separator before the last dot), and the extension (substring starting from the last dot after the last file separator).

The directory is empty if path does not contain any file separator, and the extension is empty if the remaining substring does not contain a dot. When these three strings are concatenated, the result is always equal to the initial path.

The separator depends on the operating system: a slash on unix (including Mac OS X and Linux), and a backslash or a slash on Windows.

Examples

(dir, filename, ext) = fileparts('/home/tom/report.txt')
  dir =
    /home/tom/
  filename = 
    report
  ext =
    .txt
(dir, filename, ext) = fileparts('/home/tom/')
  dir =
    /home/tom/
  filename = 
    ''
  ext =
    ''
(dir, filename, ext) = fileparts('results.txt.back')
  dir =
    ''
  filename =
    results.txt
  ext =
    .back

See also

fullfile, filesep

filesep

File path separator.

Syntax

ch = filesep

Description

filesep gives the character used as separator between directories and files in paths. It depends on the operating system: a slash on unix (including Mac OS X and Linux), and a backslash on Windows.

See also

fullfile, fileparts

fullfile

File path construction.

Syntax

path = fullfile(p1, p2, ...)

Description

fullfile constructs a file path by concatenating all its string arguments, removing separators when missing. At least one input argument is required.

Examples

fullfile('/home/tom/', 'report.txt')
  /home/tom/report.txt
fullfile('/home/tom', 'data', 'meas1.csv')
  /home/tom/data/meas1.csv

See also

fileparts, filesep