fn_fileparts

Contents

Syntax

[out1 out2...] = fn_fileparts(fname,flag1,flag2,...[,'strict'])

Description

Input:
- fname       file name
- flag        one of the possible flags below, or a cell array of flags,
              in which case fn_fileparts is applied iteratively using
              each value as flag successively
  'path'      returns the path (fn_filename('a/b/','path') returns 'a')
  'base'      removes the path and the extension (fn_filename('a/b.c','base')
              returns 'b')
  'ext'       returns the extension (fn_filename('a/b.c','ext') returns '.c')
  'extnodot'  returns the extension without dot (fn_filename('a/b.c','extnodot') returns 'c')
  'name'      removes the path (fn_filename('a/b/','name') returns 'b',
              fn_filename('a/b.c','name') returns 'b.c')
  'noext'     removes the extention (fn_filename('a/b.c','noext') returns
              'a/b')
  ''          only removes trailing '/' characters
- 'strict'    consider that the base and extension of 'a.b.c' are 'a' and
              'b.c' respectively, rather than 'a.b' and 'c'

Source

Thomas Deneux

Copyright 2003-2017