workspace clears and handles are not working after GUIDE use

2 views (last 30 days)
I have this attached matlab code where I use GUIDE.
If I, through my GUI, run either "Run resistivity log" or "Run IP logging" the code works fine. But when the code is done running, all the handles are cleared, and also the handle-function is not working anymore. So I have to close the program and run it again for it to work.
Is there anyway to avoid this? So I can keep my handles and press either buttons several times without having to close the program each time.
I get this error if I try to press one of the buttons after I have run it one time:
??? Error using ==> get Invalid handle
Error in ==> run_logging>run_res_Callback at 94 handles.task_name = get(handles.task_name,'string');
Error in ==> gui_mainfcn at 96 feval(varargin{:});
Error in ==> run_logging at 42 gui_mainfcn(gui_State, varargin{:});
Error in ==> @(hObject,eventdata)run_logging('run_res_Callback',hObject,eventdata,guidata(hObject))
??? Error while evaluating uicontrol Callback

Accepted Answer

Jan
Jan on 21 Jul 2014
This is a bad idea:
handles.task_name = get(handles.task_name,'string');
On the right side, "handles.task_name" is a handle, on the left side this variable is a string. A second run of this function must fail.

More Answers (1)

Toke
Toke on 22 Jul 2014
Yep, that was the problem. Thanks

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!