MATLAB Function Reference | ![]() ![]() |
List MATLAB-specific files in current directory
Graphical Interface
As an alternative to the what
function, use the Current Directory browser. To open it, select Current Directory from the View menu in the MATLAB desktop.
Syntax
what
what dirname
s = what('dirname')
Description
what
lists the M
, MAT
, MEX
, MDL
, and P
-files and the class directories that reside in the current working directory.
what dirname
lists the files in directory dirname
on the MATLAB search path. It is not necessary to enter the full pathname of the directory. The last component, or last couple of components, is sufficient.
Use what
class
to list the files in method directory, @class
. For example, what
cfit
lists the MATLAB files in toolbox\curvefit\curvefit\@cfit
.
s = what('dirname')
returns the results in a structure array with these fields.
what dirname
is the unquoted form of the syntax.
Examples
To list the files in toolbox\matlab\audio,
what audio M-files in directory matlabroot\toolbox\matlab\audio Contents lin2mu sound wavread auread mu2lin soundsc wavrecord auwrite saxis wavplay wavwrite MAT-files in directory matlabroot\toolbox\matlab\audio chirp handel splat gong laughter train
To obtain a structure array containing the MATLAB filenames in toolbox\ matlab\general
, type
s = what('general') s = path: 'matlabroot:\toolbox\matlab\general' m: {105x1 cell} mat: {0x1 cell} mex: {5x1 cell} mdl: {0x1 cell} p: {'helpwin.p'} classes: {'char'}
See Also
dir
, exist
, lookfor
, path
, which
, who
![]() | weekday | whatsnew | ![]() |