who

Returns the names of variables defined in the current session of the application.

Syntax

who

who(pattern)

R = who('global')

R = who(pattern, 'global')

pattern
Type: string

Outputs

R
If assigned to the result of who, R will be a cell array of strings whose elements are the names of the variables defined in the current session of the application.
Type: cell of strings

Examples

Lists both local and global variables:

localVariable1 = 247;
testLocalVariable = 'Sample';
global globalVariable2;
who
Variables in current scope:
globalVariable2
localVariable1
testLocalVariable
Lists global variables only, with output assigned to R:
localVariable1 = 247;
testLocalVariable = 'Sample';
global globalVariable2;
R = who('global')
R =
{
[1,1] globalVariable2
}
Lists global and local variables, matching the given pattern:
localVariable1 = 247;
localtest = 'Sample';
global globalVariable2;
who('*ble*')
Variables in current scope:
globalVariable2
localVariable1
Lists global variables matching the given pattern:
localVariable1 = 247;
localtest = 'Sample';
global globalVariable2;
who('*ble*', 'global')
Variables in current scope:
globalVariable2