Repeated Use (reuse) of GUI

1 次查看(过去 30 天)
I have a simple GUI with several pushbuttons, each calling a separate mfile. The first time after evoking the GUI that I press any of these buttons, the function in the realted mfile are executed. But, ever after I get the following error:
??? Undefined function or method 'FastDD' for input arguments of type 'struct'.
Error in ==> @(hObject,eventdata)FastDD('Kvalue_Callback',hObject,eventdata,guidata(hObject))
??? Error while evaluating uicontrol Callback
where, 'FastDD' being the main GUI and Kvalue being the mfile requested by the second press.
I like to retain the original GUI (FastDD) and use it over and over until I press the exit button. Appreciate any suggestion. Please note that I am a novice in using MATLAB.
  1 个评论
Image Analyst
Image Analyst 2012-4-27
If FastDD is your main (first) GUI, then why does it say this: Undefined function or method 'FastDD'??? Is it calling itself? OK, this first GUI - the one with all the pushbuttons - what is it called? And do you leave that up and running when you push the button on it the second time, or have you run it fresh and new? And what is the name of the m-file that gets run when you push the button? I'd like to figure out if it's the main/first GUI or second m-file that it's complaining about not being able to find. If you're trying to run it fresh and it's complaining about not being able to find the main GUI, then it's likely you cd'ed like Walter mentioned. To check, look at the "Current Folder" in the drop down list of the top of the MATLAB development environment before you run it and see if it's the folder where FastDD lives.

请先登录,再进行评论。

采纳的回答

Walter Roberson
Walter Roberson 2012-4-27
Does any of your code use "cd" to change directories? And perhaps fails to "cd" back to the directory that FastDD is in?
  1 个评论
Image Analyst
Image Analyst 2012-4-27
Good guess. Novices often do overuse cd, much to their peril. There's a FAQ entry on it: http://matlab.wikia.com/wiki/FAQ#Where_did_my_file_go.3F_The_risks_of_using_the_cd_function.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Interactive Control and Callbacks 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by