Reputation: 7459
Related with a question I asked before MATLAB: Automatic detection of relations between workspace variables through functions. Does any knows how can I get a vector with conteins the variable names of the workspace variables? Thank you.
Upvotes: 0
Views: 2324
Reputation: 1475
You might try:
variables_list = who;
However be aware that this might create a new variable variables_list
if it did not exist prior to this command and that in this case the string 'variables_list'
will not be in the list. You should also be careful with the special ans
variable which might or might not show up, depending on your coding style. For the kind of things you want to do, you might try to combine this with evalin
to get the list of variables of another workspace.
NB: Technically variables_list
is not a vector but a cell array.
Hope this helps.
A.
Upvotes: 2