| Products & Services | Industries | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → MATLAB |
| Contents | Index |
| Learn more about MATLAB |
As an alternative to the what function, use the Current Folder browser.
what
what folderName
what className
what packageName
s = what('folderName')
what lists the path for the current folder, and lists all files and folders relevant to MATLAB found in the current folder. Files listed are M, MAT, MEX, MDL, and P-files. Folders listed are all class and package folders.
what folderName lists path, file, and folder information for folderName. Use an absolute or partial path for folderName.
what className lists path, file, and folder information for method folder @className. For example, what cfit lists the MATLAB files and folders in toolbox/curvefit/curvefit/@cfit.
what packageName lists path, file, and folder information for package folder +packageName. For example, what commsrc lists the MATLAB files and folders in toolbox/comm/comm/+commsrc.
s = what('folderName') returns the results in a structure array with the fields shown in the following table.
Field | Description |
|---|---|
path | Path to folder |
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 folders |
packages | Cell array of package folders |
List the MATLAB files and folders 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 file and folder names in toolbox/matlab/general that are relevant to MATLAB:
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}
Find the supporting M-files for one of the packages in the Communications Toolbox product:
p1 = what('comm');
p1.packages
ans =
'commdevice'
'crc'
'commsrc'
p2 = what('commsrc');
p2.m
ans =
'abstractJitter.m'
'abstractPulse.m'
'combinedjitter.m'
'diracjitter.m'
'periodicjitter.m'
'randomjitter.m'dir, exist, lookfor, ls, mfilename, path, which, who
![]() | weekday | whatsnew | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |