MATLAB: GUI Push Button Behavior

callbackguiguide

I have a push button which, when pressed, uses the uigetdir function to get a directory. However, when I press it again, I get an error:
??? Undefined function or method 'Program' for input arguments of type
'struct'.
Error in ==>
@(hObject,eventdata)Program('load_Callback',hObject,eventdata,guidata(hObject))
??? Error while evaluating uicontrol Callback
I want it to simply reopen the uigetdir dialog and load a new directory, if pressed again.

Best Answer

Does "Program" try to call another function called "Prpgram"??? Maybe it's just a spelling mistake. What is the tag property of your pushbutton? Is the button called load? Set a breakpoint in the callback. Does it ever get there when you click the button? Do you know how to use the debugger? This would be fairly simple if you did.