如何在MATLAB中列出全局变量?

San*_*har 9 matlab global-variables

如何查看MATLAB中定义的全局变量列表?(我正在使用R2009a).

我已经在Google和SO上为此进行了无用的搜索,所以如果之前有人问过道歉的话.

gno*_*ice 14

WHO/WHOS命令可以显示你刚才的全局变量:

who global   %# Shows just the variable names
whos global  %# Shows variable information, like size, class, etc.
Run Code Online (Sandbox Code Playgroud)

您还可以获取变量中返回的变量名称/信息,而不是显示在屏幕上:

names = who('global');  %# A cell array of variable names
data = whos('global');  %# A structure array of variable information
Run Code Online (Sandbox Code Playgroud)