Main Content

谁是

列出工作区中的变量,大小和类型

Description

例子

谁是lists in alphabetical order the names, sizes, and types of all variables in the currently active workspace.

例子

谁是-file文件名lists variables in the specified MAT-file.

谁是全球的列出全局工作区中的变量。

例子

谁是___var1 ...华尔恩仅列出指定的变量。使用此语法与上一个语法中的任何参数。

例子

谁是___-regexpexpr1 ... exprN仅列出与指定的正则表达式匹配的变量。

例子

S.= WHOS(___的)stores information about the variables in the structure arrayS.

笔记

您必须使用功能形式谁是when there is an output argument.

Examples

collapse all

在当前工作区中显示有关特定变量的信息。例如,列出有关变量的信息,名称以字母开头一种

谁是一种*

Now, list information about variables with names that end with离子

谁是-regexp离子$

显示存储在Sample Mat文件中的变量的所有信息杜尔.MAT

谁是-file杜尔.MAT
Name Size Bytes Class Attributes X 648x509 2638656 double caption 2x28 112 char map 128x3 3072 double

存储有关变量的信息杜尔.MATin structure arrayS.

S.= WHOS('-文件''durem.mat');

显示内容S.

为了k = 1:length(S) disp([''S.(k).name......''Mat2str(s(k).size)......''s(k).class]);结尾
X [648 509]双字幕[2 28] Char Map [128 3]双重

使用各种属性创建变量,然后显示有关它们的信息。

Create a file,show_attributes.m.那that contains these statements.

functionshow_attributes.执着的p;全球的g; p = 1; g = 2; s = sparse(eye(5)); c = [4+5i 9-3i 7+6i]; whos

称呼show_attributes.。When MATLAB® executes the谁是命令结束时show_attributes.那it lists each variable and its corresponding attribute.

show_attributes.
名称大小字节类属性C 1x3 48双重复杂G 1x1 8双全球P 1x1 8双持久S 5x5 128双稀疏

List all the variables in the current workspace while paused in a nested function.

Create a file,谁是_demo.m那that contains these statements.

functionwhos_demo date_time = datestr(现在,'dd-mmm-yyyy');date_time_array = strsplit(date_time,{' - '''}); get_date(date_time_array);functionget_date(d) day = d{1};%#OK <* NASGU>mon = d {2};年= d {3};键盘结尾结尾

谁是_demo。马铃薯草®pauses at the line with the键盘命令。

谁是_demo
K>>

打电话给谁是功能。MATLAB在嵌套中显示变量get_date函数,以及包含嵌套函数的所有函数中的变量,由函数工作区分组。

k >> Whos.
Name Size Bytes Class Attributes ---- whos_demo/get_date --------------------------------------- d 1x3 354 cell day 1x2 4 char mon 1x3 6 char year 1x4 8 char ---- whos_demo ------------------------------------------------ date_time 1x11 22 char date_time_array 1x3 354 cell

Input Arguments

collapse all

要显示的变量,指定为一个或多个字符向量或字符串标量。使用'*'通配符以匹配模式。例如,谁是* s *lists the names of all the variables in the workspace that start with一种orS.

Regular expressions that define the variables to display, specified as one or more character vectors or string scalars. For example,谁是-regexp ^Mon ^Tues仅列出从工作区中开始的变量名称周一orTues。For more information about creating regular expressions, see常用表达

MAT文件的名称,指定为字符向量或字符串标量。文件名可以包括完整,相对或部分路径。例如,whos -file myfile.mat列出名为Mat文件中的所有变量myfile.mat。The谁是-file文件名命令不返回任何MATLAB ob的大小jects in file文件名

数据类型:char|细绳

输出参数

collapse all

可变信息,作为包含标量的嵌套结构数组返回struct对于每个变量。每个标量structcontains these fields.

场地 Description

姓名

变量的名称。

尺寸

变量阵列的尺寸。

bytes

为变量数组分配的字节数。

谁是returns the number of bytes each variable occupies in the workspace, which is not necessarily the same as the number of bytes each variable occupies in a MAT-file. MAT-files Version 7 and later are compressed, so the number of bytes required in the workspace is typically larger than the number of bytes in the file.

谁是does not report the number of bytes consumed by handle objects. If a variable contains handle objects, the number of bytes that the谁是变量的功能显示可能小于预期。

班级

变量的类。如果变量没有值,则类是'(unassigned)'

全球的

true如果变量是全局的。

trueif the variable is sparse.

复杂的

trueif the variable is complex.

nesting

结构与这些字段:

  • function- 定义变量的嵌套或外部函数的名称。

  • level-Nesting level of that function.

执着的

true如果变量是持久的。

备择方案

  • 您还可以使用当前文件夹浏览器的详细信息面板查看MAT文件的内容。详细信息面板不可用Matlab Online™

扩展能力

版本历史记录

Introduced before R2006a