开发者

How can I list global variables in MATLAB?

开发者 https://www.devze.com 2022-12-28 06:55 出处:网络
How can I see a list of what global var开发者_开发问答iables are defined in MATLAB? (I am using R2009a).

How can I see a list of what global var开发者_开发问答iables are defined in MATLAB? (I am using R2009a).

I have hunted unfruitfully for this on Google and SO, so apologies if it has been asked before.


The WHO/WHOS commands can show you just the global variables:

who global   %# Shows just the variable names
whos global  %# Shows variable information, like size, class, etc.

You can also get the variable names/information returned in a variable instead of displayed on the screen:

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


If you type whos at the command line Matlab will list all currently defined variables in your workspace. The last column of output is headed 'Attributes', global variables have the attribute 'global'.

0

精彩评论

暂无评论...
验证码 换一张
取 消