GUI Push Button Behavior
1 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
采纳的回答
Image Analyst
2012-12-11
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.
2 个评论
Image Analyst
2012-12-11
cd() should not be necessary - I rarely use it. uigetdir() will work just fine without calling cd(). However if you pass a directory to uigetdir(), you should use exist(folder, 'dir') first to make sure the directory exists.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 File Operations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!