MATLAB Answers

Base workspace variable name

6 views (last 30 days)
Is there any command to get the base workspace variable name ?
  2 Comments
Gopalakrishnan venkatesan
I have a function like below
function data()
run('D:\......\comp.m')
end
so now comp.m will run and store the repective variable in base workspace.
Problem is now i need to get the name of the base workspace variables

Sign in to comment.

Accepted Answer

Thorsten
Thorsten on 4 Dec 2015
Edited: Thorsten on 4 Dec 2015
S = whos;
varname = {S.name};
  5 Comments
Gopalakrishnan venkatesan
I have a function like below
function data()
run('D:\......\comp.m')
end
so now comp.m will run and store the repective variable in base workspace only right. I need the variable name so oly. Like wise this will run in loops

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!