MATLAB Function Reference |
Graphical Interface
As an alternative to whos
, use the Workspace browser. Or use the Current Directory browser to view the contents of MAT-files without loading them.
Syntax
Each of these syntaxes apply to both who
and whos
:
who who(variable_list) who(variable_list, qualifiers) s = who(variable_list, qualifiers) who variable_list qualifiers
Description
who
lists the variables currently in the workspace.
whos
lists the current variables and their sizes and types. It also reports the totals for sizes.
who(variable_list) and whos(variable_list)
list only those variables specified in variable_list
, where variable_list
is a comma-delimited list of quoted strings: 'var1', 'var2', ..., 'varN'
. You can use the wildcard character *
to display variables that match a pattern. For example, who('A*')
finds all variables in the current workspace that start with A
.
who(variable_list, qualifiers) and whos(variable_list, qualifiers)
list those variables in variable_list
that meet all qualifications specified in qualifiers
. You can specify any or all of the following qualifiers, and in any order.
Qualifier Syntax |
Description |
Example |
'global' |
List variables in the global workspace. |
whos('global') |
'-file' , filename |
List variables in the specified MAT-file. Use the full path for filename . |
whos('-file', 'mydata') |
List variables that match any of the regular expressions in exprlist . |
whos('-regexp', '[AB].', '\w\d' ) |
s = who(variable_list, qualifiers)
returns cell array s
containing the names of the variables specified in variable_list
that meet the conditions specified in qualifiers
.
s = whos(variable_list, qualifiers)
returns structure s
containing the following fields for the variables specified in variable_list
that meet the conditions specified in qualifiers
:
name
variable namesize
variable sizebytes
number of bytes allocated for the arrayclass
class of variable
who variable_list qualifiers and whos variable_list qualifiers
are the unquoted forms of the syntax. Both variable_list
and qualifiers
are space-delimited lists of unquoted strings.
Remarks
Information returned by the command whos -file
is independent of whether the data in that file is compressed or not. The byte counts returned by this command represent the number of bytes data occupies in the MATLAB workspace, and not in the file the data was saved to. See the function reference for save
for more information on data compression.
Examples
Show variable names starting with the letter a:
Show variables stored in MAT-file mydata.mat
that start with java
and end with Array
. Also show their dimensions and class name:
whos -file mydata -regexp \<java.*Array\> Name Size Bytes Class javaChrArray 3x1 java.lang.String[][][] javaDblArray 4x1 java.lang.Double[][] javaIntArray 14x1 java.lang.Integer[][]
Get variable names that start with uppercase or lowercase X
, are followed by zero or more other characters, and end with at least two digits. Assign the output to cell array xvars
:
xvars = who('-regexp', '^[Xx].*\d{2,}$') xvars = 'X_JohnDavis_5May03' 'Xtest_120' 'xArray5by12' 'x_times_3pt82'
See Also
assignin
, clear
, computer
, dir
, evalin
, exist
, inmem
, load
, save
, what
, workspace
whitebg | wilkinson |
© 1994-2005 The MathWorks, Inc.