登录论坛

查看完整版本 : 如何在MATLAB中列出全局变量?


poster
2019-12-10, 20:41
如何查看在MATLAB中定义的全局变量的列表? (我正在使用R2009a)。

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



回答:

WHO / WHOS (http://www.mathworks.com/access/helpdesk/help/techdoc/ref/who.html)命令可以仅向您显示全局变量:

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

更多&回答... (https://stackoverflow.com/questions/2731925)