filepathparts
by DS
02 Jul 2007
(Updated 04 Jul 2007)
Returns cell array of strings containing individual directories from a specified file path.
|
Watch this File
|
| File Information |
| Description |
Simple function that complements the built-in functions FULLFILE and FILEPARTS. This function parses the pathstr output of fileparts and returns a cell array of strings containing the individual directories in the specified filepath string, given as input.
Example:
directory ='C:\Dir1\Dir2\Dir3\DirN';
filename = 'Filename.ext';
pandf = fullfile(directory,filename);
filepathparts(pandf)
ans = 'DriveLetter:'
'Dir1'
'Dir2'
'Dir3'
'DirN'
Algorithm*:
-----------
C = strread(pathstr,'%s','delimiter',...
strrep(filesep,'\','\\'));
*suggested by Jos x@y.z |
| MATLAB release |
MATLAB 7.0.4 (R14SP2)
|
|
Tags for This File
|
| Everyone's Tags |
|
| Tags I've Applied |
|
| Add New Tags |
Please login to tag files.
|
| Comments and Ratings (4) |
| 02 Jul 2007 |
Jos x@y.z
|
|
|
| 02 Jul 2007 |
D S
|
|
|
| 14 Sep 2009 |
julien diener
|
|
|
| 04 Oct 2009 |
DS
|
|
|
| Updates |
| 03 Jul 2007 |
Changed the ugly STRFIND-based algorithm for the one-line solution suggested by Jos x@y.z.
Added uigetfile behavior for no input case. Added check to cope with path or path+filename input. |
| 04 Jul 2007 |
Fixed the example in the m-file help text. |
|
Contact us at files@mathworks.com