| MATLAB Function Reference | ![]() |
As an alternative to the what function, use the Current Directory Browser. To open it, select Current Directory from the Desktop menu in the MATLAB desktop.
what
what dirname
what class
s = what('dirname')
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 two components, is sufficient.
what class lists 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.
Field | Description |
|---|---|
path | Path to directory |
m | Cell array of M-file names |
mat | Cell array of MAT-file names |
mex | Cell array of MEX-file names |
mdl | Cell array of MDL-file names |
p | Cell array of P-file names |
classes | Cell array of class directories |
List the files in toolbox/matlab/audiovideo:
what audiovideo M-files in directory matlabroot\toolbox\matlab\audiovideo Contents avifinfo sound audiodevinfo aviinfo soundsc audioplayerreg aviread wavfinfo audiorecorderreg lin2mu wavplay audiouniquename mmcompinfo wavread aufinfo mmfileinfo wavrecord auread movie2avi wavwrite auwrite mu2lin avgate prefspanel MAT-files in directory matlabroot\toolbox\matlab\audiovideo chirp handel splat gong laughter train MEX-files in directory matlabroot\toolbox\matlab\audiovideo winaudioplayer winaudiorecorder Classes in directory matlabroot\toolbox\matlab\audiovideo audioplayer avifile audiorecorder mmreader
Obtain a structure array containing the MATLAB filenames in toolbox/matlab/general:
s = what('general')
s =
path: 'matlabroot:\toolbox\matlab\general'
m: {89x1 cell}
mat: {0x1 cell}
mex: {2x1 cell}
mdl: {0x1 cell}
p: {'callgraphviz.p'}
classes: {'char'}
packages: {0x1 cell}
dir, exist, lookfor, mfilename, path, which, who
![]() | weekday | whatsnew | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |