Products & Services Industries Academia Support User Community Company

Learn more about MATLAB   

what - List MATLAB files in folder

Graphical Interface

As an alternative to the what function, use the Current Folder browser.

Syntax

what
what folderName
what className
what packageName
s = what('folderName')

Description

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

Examples

List Files and Folders Relevant to MATLAB

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

Return Names to a Structure

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}

List M-Files in a Package

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'

See Also

dir, exist, lookfor, ls, mfilename, path, which, who

Managing Files in MATLAB

  


Recommended Products

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