GUI execution from .fig file

3 次查看(过去 30 天)
I am testing a GUI that I built. The GUI works fine when it is called from the Command Window or when I click the "Run" button from within the .m file. However, when I try to operate the GUI from the .fig file, only some of the features work. Is this normal? Can you run GUIs from the .fig file? So far, the only code for the GUI is related to a pushbutton:
function pushbuttonBrowse_Callback(hObject, eventdata, handles)
FileName = uigetfile({'*.xls';'*.xlsx';'*.csv';'*.dat'});
guidata(hObject, handles)
set(handles.txtbxSelectFile,'String',FileName)
The pushbutton calls data from a spreadsheet and then displays the file name in a textbox. When the code doesn't work, it only calls the data, but will not display the file name. Your help is greatly appreciated!

采纳的回答

Image Analyst
Image Analyst 2012-4-6
How do you run the GUI from the fig file?
  • If you have the fig file open in GUIDE and click the run icon (the green triangle icon) then it will run just the same as if you had typed F5 or clicked the green triangle icon in the text editor in MATLAB.
  • If you try to run it by double-clicking the .fig file in the "Current Folder" panel in MATLAB, then I've heard that you will have problems. (I never do it that way so I don't know but everyone says so.)

更多回答(2 个)

Walter Roberson
Walter Roberson 2012-4-6
You cannot launch a GUI by starting from the .fig file.

Steven
Steven 2012-4-9
Thank you both! I was clicking on the .fig file, but I guess you can't run GUIs that way. Thank you for your quick response!

类别

Help CenterFile Exchange 中查找有关 Environment and Settings 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by