Clear vairables in workspace using gui pushbutton callback??
2 次查看(过去 30 天)
显示 更早的评论
Hi guys,
here is my problem:
i load a mat file that contains several variables before i run my gui. I use these variables with the help of "evalin" command in my gui callbacks.
Let say my workspace variables are these : A cell , B cell , C double,... goes on.
I want to clear all variables in the workspace window using a push button callback.
" I want to clear variables that i loaded before i run my gui".
(i read some answers and there was a conflict about the workspace term. I MEAN THE VARIABLES APPER IN MATLAB WORKSPACE WINDOW, NOT THE GUI WORKSPACE. )
2 个评论
Pathmashantha Senanayaka
2020-12-30
I am university student. I am doing my final project using matlab guide. But i am new to matlab. So, can you please help me.
采纳的回答
Geoff Hayes
2015-2-1
Ozgur - if there are specific variables that you want to clear from the MATLAB (base) workspace, then you could use evalin with clear. If you put the following line in a push button callback, then
evalin('base','clear A B')
would clear the variables A and B that are in your base workspace.
But why are there variables in your base workspace that you need to evaluate in your GUI? Why not pass them as inputs to the GUI upon startup, or load them from a mat file and so avoid all of the evalin calls (which make troubleshooting bugs somewhat difficult).
更多回答(1 个)
HAMZA ABBASI
2018-6-24
clear object name like (clear a) will not work.... write clear all statement in the first line of code
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Whos 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!