| MATLAB Function Reference | Search  Help Desk |
| dir | Examples See Also |
Syntax
dir
dir dirname
names = dir
names = dir('dirname')
Description
dir
lists the files in the current directory.
dir dirname
lists the files in the specified directory. You can use pathnames and wildcards.
names = dir('dirname')
returns the list of files in the specified directory (or the current directory if dirname is not specified) to an m-by-1 structure with the fields:name |
Filename |
date |
Modification date |
bytes |
Number of bytes allocated to the file |
isdir |
1 if name is a directory; 0 if not |
Examples
cd /Matlab/Toolbox/Local; dir
Contents.m matlabrc.m siteid.m userpath.m
names = dir
names =
4x1 struct array with fields:
name
date
bytes
isdir
See Also
cd, delete, ls, type, what