who
Lists the names of the variables in the current workspace.
Category: Data Import and Analysis > Data Import and Export
Syntax
who
Prints the variable names in columns.
who name1 name2
Prints only the listed variables that exist.
c = who
Returns the names as a cell array of character vectors instead of printing.
Description
who shows only names. Use whos when you also want the size, byte count and class of each variable. Names are sorted alphabetically, and with an output argument the list comes back as data you can loop over or filter.
In a live script the workspace panel shows the same information interactively, so who is mostly useful in plain scripts and in the command line.
Input arguments
name1, name2- Variable names. Wildcards such as
a*select by pattern.
Output arguments
c- Cell array with one variable name per cell, in alphabetical order.
Example
Names in the workspace
x = 1; y = 'hi'; z = [1 2 3];
c = who;
disp(c')
who x
Output
{'x'} {'y'} {'z'}
Your variables are:
x