Main Content

what

List MATLAB files in folder

Description

what lists the path for the current folder and all the MATLAB® relevant files and folders found in the current folder. This includes MATLAB program files (.m and .mlx), MAT-files, Simulink® model files (.mdl and .slx), MEX-files, MATLAB app files (.mlapp), and P-files, as well as all class and package folders.

what folderName lists path, file, and folder information for folderName. You do not need to specify the @ or + symbol for class and package folders. For example, what table lists the MATLAB files and folders in toolbox/matlab/datatypes/@table.

example

s = what(___) returns the results in a structure array. You can use this syntax with any of the input argument combinations in the previous syntaxes.

example

Examples

collapse all

List the MATLAB files and folders in the graph2d folder. The location of this folder depends on your installation.

what graph2d
MATLAB Code files in folder matlabroot\toolbox\matlab\graph2d

Contents               figtoolset             loglog                 putdowntext            setscribeobjectdata    
axis                   getcolumn              middrag                rbbox                  sgtitle                
basicfitdatastat       getobj                 moveaxis               scribeclearmode        subplot                
box                    getorcreateobj         pan                    scribeeventhandler     texlabel               
doclick                getscribecontextmenu   plot                   scriberestoresavefcns  title                  
dokeypress             getscribeobjectdata    plotedit               scribetextdlg          xlabel                 
domymenu               grid                   plotyy                 semilogx               ylabel                 
doresize               gtext                  polar                  semilogy               zoom                   
enddrag                jpropeditutils         prepdrag               setscribecontextmenu   

P-files in folder matlabroot\toolbox\matlab\graph2d

axis     sgtitle  subplot  zoom     

Classes in folder matlabroot\toolbox\matlab\graph2d

arrowline     axisobj       editline      fighandle     hgbin         scribehgobj   
axischild     axistext      editrect      figobj        scribehandle  

Find the Fixed-Point Designer™ folders that contain MATLAB files.

s = what('fixpoint')
s = 

  struct with fields:

        path: 'matlabroot\toolbox\fixpoint'
           m: {4×1 cell}
       mlapp: {0×1 cell}
         mlx: {0×1 cell}
         mat: {0×1 cell}
         mex: {0×1 cell}
         mdl: {0×1 cell}
         slx: {0×1 cell}
         sfx: {0×1 cell}
           p: {4×1 cell}
     classes: {0×1 cell}
    packages: {5×1 cell}

List the packages in the matlabroot\toolbox\fixpoint folder.

s.packages
ans =

  5×1 cell array

    {'DataTypeOptimization' }
    {'DataTypeWorkflow'     }
    {'FunctionApproximation'}
    {'IRInstrumentation'    }
    {'cpopt'                }

Find the supporting files for the DataTypeWorkflow package.

s2 = what('DataTypeWorkflow');
s2.p
ans =

  6×1 cell array

    {'DTWRun.p'                 }
    {'RangeCollectionMode.p'    }
    {'Result.p'                 }
    {'VerificationResult.p'     }
    {'findDecoupledSubsystems.p'}
    {'hyperlink.p'              }

Input Arguments

collapse all

Name of folder, specified as a character vector or string scalar.

For a local folder, it is not necessary to give the full path of the folder. Instead, you can specify a relative partial path. For example, what strfun and what matlab/strfun both list the MATLAB files in toolbox/matlab/strfun. However, if the folder is at a remote location, then folderName must contain a full path specified as a uniform resource locator (URL). For more information, see Work with Remote Data.

The case sensitivity of folderName is determined by your file system. In general, Windows® and Mac systems are case insensitive and therefore, what returns results for all case variations of folderName. For example, suppose the folder c:\mycode containing the file myfile.m exists on a Windows file system. what successfully locates the folder even if the incorrect case is specified.

what MYCodE
MATLAB Code files in folder c:\mycode
myfile

On Linux® systems, which are generally case sensitive, what returns zero results.

Output Arguments

collapse all

List of path, files, and folders returned as a structure array with these fields.

Field

Description

path

Full path to folder

m

Cell array of MATLAB program file names

mlapp

Cell array of MLAPP-file names

mapp

Cell array of MAPP-file names
mlx

Cell array of MLX-file names

mat

Cell array of MAT-file names

mex

Cell array of MEX-file names

mdl

Cell array of MDL-file names

slx

Cell array of SLX-file names

sfx

Cell array of SFX-file names

p

Cell array of P-file names

classes

Cell array of class folders

packages

Cell array of package folders

Extended Capabilities

Version History

Introduced before R2006a