Clean variables of worskpace from GUIDE

3 ビュー (過去 30 日間)
Alexander
Alexander 2013 年 6 月 17 日
コメント済み: Stephen23 2021 年 8 月 16 日
Hi Everyone!
I have a problem with a code in GUIDE. I want clean some variables of workspace that previously I saved from GUIDE. To save variables in workspace, I've used this code:
if true
% assignin('base', 'VHA', VHA);
end
And to obtain variables from workspace i use evalin
if true
% evalin('base','VHA');
end
I know that 'clear' doesn't work in GUIDE. So ¿which should to use? I don't want clean all variables.

採用された回答

Babak
Babak 2013 年 6 月 17 日
You can send commands to base workspace using the evalin() function as you mentioned. For example you can say:
evalin('base','who')
and to clear a variable myvarinbase say
evalin('base','clear myvarinbase')
Note that
clear var1 var2
will remove variables var1 var2 from the current workspace, not necessarily base workspace, if it is called from inside a function like a GUI.
  1 件のコメント
Alexander
Alexander 2013 年 6 月 18 日
Thank you for your suggestion of evalin. This allowed me to reduce a lot of code because I was using assignin.
I used
evalin('base','clear n')
for clean the N variable or
evalin('base','clear all')
for clean all variables of workspace.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by