Base workspace variable name

3 次查看(过去 30 天)
Is there any command to get the base workspace variable name ?
  2 个评论
Guillaume
Guillaume 2015-12-4
In which contest? within a function? Which variable? All of them? An input to a function?
Gopalakrishnan venkatesan
编辑:Gopalakrishnan venkatesan 2015-12-4
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

请先登录,再进行评论。

采纳的回答

Thorsten
Thorsten 2015-12-4
编辑:Thorsten 2015-12-4
S = whos;
varname = {S.name};
  5 个评论
Guillaume
Guillaume 2015-12-4
"use evalin": Here be dragons. Do not go down that path unless you know what you're doing and know all the pitfalls of using eval and its friends.
For what reasons do you want to have the list of variables in the base workspace?
Gopalakrishnan venkatesan
编辑:Gopalakrishnan venkatesan 2015-12-4
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

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Scope Variables and Generate Names 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by