Main Content

what

列出文件夹中的 MATLAB 文件

说明

what 列出当前文件夹的路径以及在当前文件夹中找到的与 MATLAB® 相关的所有文件和文件夹。这包括 MATLAB 程序文件(.m.mlx)、MAT 文件、Simulink® 模型文件(.mdl.slx)、MEX 文件、MATLAB App 文件 (.mlapp)、P 文件以及所有的类文件夹和包文件夹。

示例

what folderName 列出 folderName 的路径、文件和文件夹信息。您无需为类和包文件夹指定 @+ 符号。例如,what table 列出 toolbox/matlab/datatypes/@table 中的 MATLAB 文件和文件夹。

示例

s = what(___) 返回结构体数组形式的结果。您可以将此语法与上述语法中的任何输入参数结合使用。

示例

全部折叠

列出 graph2d 文件夹中的 MATLAB 的文件和文件夹。此文件夹的位置取决于您的安装情况。

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  

查找包含 MATLAB 文件的 Fixed-Point Designer™ 文件夹。

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}

列出 matlabroot\toolbox\fixpoint 文件夹中的包。

s.packages
ans =

  5×1 cell array

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

查找 DataTypeWorkflow 包的支持文件。

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

  6×1 cell array

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

输入参数

全部折叠

文件夹的名称,指定为字符向量或字符串标量。

对于本地文件夹,不需要给出文件夹的完整路径。相反,您可以指定相对部分路径。例如,what strfunwhat matlab/strfun 都列出了 toolbox/matlab/strfun 中的 MATLAB 文件。但是,如果该文件夹位于远程位置,则 folderName 必须包含指定为统一资源定位器 (URL) 的完整路径。有关详细信息,请参阅处理远程数据

folderName 是否区分大小写由您的文件系统决定。一般来说,Windows®Mac 系统不区分大小写,因此 what 会为 folderName 的各种大小写变体都返回结果。例如,假设 Windows 文件系统上存在包含文件 myfile.m 的文件夹 c:\mycode。即使指定错误的大小写,what 也能成功找到该文件夹。

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

在 Linux® 系统上,通常区分大小写,因此 what 将返回零个结果。

输出参数

全部折叠

路径、文件和文件夹的列表,以包含以下字段的结构体数组形式返回。

字段

描述

path

文件夹的完整路径

m

MATLAB 程序文件名的元胞数组

mlapp

包含 MLAPP 文件名称的元胞数组

mlx

包含 MLX 文件名称的元胞数组

mat

包含 MAT 文件名称的元胞数组

mex

包含 MEX 文件名称的元胞数组

mdl

包含 MDL 文件名称的元胞数组

slx

包含 SLX 文件名称的元胞数组

sfx

包含 SFX 文件名称的元胞数组

p

包含 P 文件名称的元胞数组

classes

包含类文件夹的元胞数组

packages

包含程序包文件夹的元胞数组

扩展功能

版本历史记录

在 R2006a 之前推出

另请参阅

| | | | |