How to clear GUI variables?
3 ビュー (過去 30 日間)
古いコメントを表示
Hi,
I'm trying to clear GUI variables. From what I understand, each callback function has its own workspace and separate global workspace. I'd like to clear a specific callback variables with a push button. (Callback function is blockremover_callback, I'd like to reset with a push button).
Thanks!
function clearscreen_Callback(hObject, eventdata, handles)
global xy h binary
%evalin('base','clear h')
clear blockremover_callback
xy = [];
h = [];
binary = [];
%evalin('base','clear all');
cla;
0 件のコメント
採用された回答
Image Analyst
2013 年 12 月 18 日
You can clear global variables with clear global.
clear global xy;
clear global h;
clear global binary;
After you clear them, if you need them you need to declare them again:
global xy;
global h;
global binary;
There is no need to clear local variables as they vanish once the function exits.
3 件のコメント
Image Analyst
2013 年 12 月 18 日
Like I said in your other question, if it thinks there is more than one image in an axes, then call cla('reset') before calling imshow() so that the axes is emptied before loading an image into it.
その他の回答 (1 件)
Walter Roberson
2013 年 12 月 17 日
No, there is only one global workspace.
Each function may have its own persistent variables. Those variables may be cleared by using "clear" together with the function name.
参考
カテゴリ
Help Center および File Exchange で Migrate GUIDE Apps についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!