Clear all variables in GUI without clearing GUI handles?
Show older comments
The question is pretty straightforward as is but I will proceed by giving a little background on its application.
I have a GUI in which I upload a bunch of cases from text files. I then, or at least I would like to, run the simulations for each of the cases upon clicking a "RUN" button. Within the callback function of the "RUN" pushbutton I have the for loop to sweep through my DoE (Design of Experiments a.k.a my cases). Currently I have the following:
for r = 1 : number_cases
clearvars -global
clearvars -except r number_cases files case_list
set(handles.case_list,'Value',r)
progress = [num2str(r) ' of ' num2str(number_cases)];
set(handles.progress_text,'String',progress)
pause(1)
...
The problem is when I run this I receive the following error:
??? Reference to a cleared variable handles.
There in lies my dilemma. How do I also avoid clearing all variables except for the GUI handles???
1 Comment
Walter Roberson
on 15 Jun 2013
Why not add "handles" to the -except list ?
Answers (0)
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!