Navigation

Operators and Keywords

Function List:

C++ API

fileparts.m File Reference


Functions

 if (isempty(ds)) ds=0
 if (es<=ds) es
endif if (ds==0) directory
 elseif (ds==1) directory
 if (es > 0 &&es<=length(filename)) extension
else error ("fileparts: expecting filename argument to be a string")
endif else print_usage ()
 !assert (strcmp(d,"")&&strcmp(n,"file")&&strcmp(e,""))
 !assert (strcmp(d,"")&&strcmp(n,"file")&&strcmp(e,".ext"))
 !assert (strcmp(d,"/")&&strcmp(n,"file")&&strcmp(e,".ext"))
 !assert (strcmp(d,"dir")&&strcmp(n,"file")&&strcmp(e,".ext"))
 !assert (strcmp(d,".")&&strcmp(n,"file")&&strcmp(e,".ext"))
 !assert (strcmp(d,"d1/d2")&&strcmp(n,"file")&&strcmp(e,".ext"))
 !assert (strcmp(d,"/d1/d2")&&strcmp(n,"file")&&strcmp(e,".ext"))
 !assert (strcmp(d,"/")&&strcmp(n, char(zeros(1, 0)))&&strcmp(e,".ext"))
 !assert (strcmp(d,"")&&strcmp(n, char(zeros(1, 0)))&&strcmp(e,".ext"))

Variables

 function [directory, name, extension, version]
endif es = rindex (filename, ".")
else directory = filename(1:ds-1)
endif name = filename(ds+1:es-1)
else extension = ""
endif version = ""
endif endfunction !test [d, n, e] = fileparts ("file")

Function Documentation

!assert ( strcmp(d,"")&&strcmp(n, char(zeros(1, 0)))&&strcmp(e,".ext")   ) 

!assert ( strcmp(d,"/")&&strcmp(n, char(zeros(1, 0)))&&strcmp(e,".ext")   ) 

!assert ( strcmp(d,"/d1/d2")&&strcmp(n,"file")&&strcmp(e,".ext")   ) 

!assert ( strcmp(d,"d1/d2")&&strcmp(n,"file")&&strcmp(e,".ext")   ) 

!assert ( strcmp(d,".")&&strcmp(n,"file")&&strcmp(e,".ext")   ) 

!assert ( strcmp(d,"dir")&&strcmp(n,"file")&&strcmp(e,".ext")   ) 

!assert ( strcmp(d,"/")&&strcmp(n,"file")&&strcmp(e,".ext")   ) 

!assert ( strcmp(d,"")&&strcmp(n,"file")&&strcmp(e,".ext")   ) 

!assert ( strcmp(d,"")&&strcmp(n,"file")&&strcmp(e,"")   ) 

elseif ( ds  = =1  ) 

else error ( "fileparts: expecting filename argument to be a string  ) 

if ( es  ,
0 &&es<=  lengthfilename 
)

endif if ( ds  = =0  ) 

if ( es<=  ds  ) 

if ( isempty(ds)   )  [pure virtual]

endif else print_usage (  ) 


Variable Documentation

!test[d, n, e] = fileparts ("file")

else directory = filename(1:ds-1)

endif es = rindex (filename, ".")

Initial value:

 fileparts (filename)

  if (nargin == 1)
    if (ischar (filename))
      ds = strchr (filename, filesep ("all"), 1, "last")

endif name = filename(ds+1:es-1)

endif version = ""