How to save a variable from a function and use it in another function in MATLAB GUI?
显示 更早的评论
Hi,
I have made a MATLAB GUI which has two buttons. I want to perform some tasks on CallBack event of both these buttons.
I have obtained a variable FileName when the first button is pressed. But as soon as the function of first button ends, the variable gets deleted. I want to use this variable when the second button is pressed which is obviously a different function. Since, the first function variable is deleted as soon as the function ends, how can I use this variable within the second button's function.
I know how to do it by saving it as .mat and recalling it but it will make the GUI interface unfriendly. Can you please tell me another way to save a variable before the first function ends and recall it later in the second function?
Thank you.
采纳的回答
更多回答(1 个)
Sean de Wolski
2011-6-22
1 个投票
1 个评论
Krishna Kumar
2011-6-22
Yes.I had suggested the same
in OP's thread in newsgroup-http://www.mathworks.com/matlabcentral/newsreader/view_thread/309582
类别
在 帮助中心 和 File Exchange 中查找有关 Variables 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!