how to clear all the variables in the GUI every time when we run it?
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi,
I have a GUI in which I'll load an image and do some analysis to it. But, when I load the next image to do analysis in the same GUI, I want to clear all the variables.
I used "clear all" in the callback of push button where I'll load the image.
But, I am facing error as
Reference to a cleared variable handles.
Error in Immunostaining_GUI>load_image_Callback (line 110)
set(handles.text1,'string',details);
Any suggestions please.
Thanks...
0 Kommentare
Antworten (1)
Image Analyst
am 3 Feb. 2015
You don't want to do that! Doing that will blow away the handles structure which is essential for running your GUIDE-built GUI. When you click some button, say Go!, to start off your image processing, it will run the callback for the Go! button and when it enters that callback, there will be no variables existing except the handles structure. So there is nothing to clear - no need to. You have to create all variables that you will need and use, for example by using global, getappdata, the handles fields, reading mat files, reading workbooks, reading image files with imread(), calling zeros() or ones() or rand(), etc., or by simple assignment
2 Kommentare
Image Analyst
am 3 Feb. 2015
I know you're not, but you're still entering a callback function to do your operations. And that callback function has a completely new workspace - clean slate with no variables in it except handles. Why do you think the variables are still in existence???
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!