查看单个帖子
旧 2019-12-10, 20:41   #1
poster
高级会员
 
注册日期: 2019-11-21
帖子: 3,006
声望力: 66
poster 正向着好的方向发展
帖子 如何在MATLAB中列出全局变量?

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

我已经在Google和SO上对此进行了不成功的狩猎,因此,如果之前曾被询问过,我深表歉意。



回答:

WHO / WHOS命令可以仅向您显示全局变量:

who global %# Shows just the variable names whos global %# Shows variable information, like size, class, etc. 您还可以获取在变量中返回的变量名称/信息,而不是显示在屏幕上:

names = who('global'); %# A cell array of variable names data = whos('global'); %# A structure array of variable information

更多&回答...
poster 当前离线   回复时引用此帖