Browse Button in GUIDE issue
Show older comments
Hi, I have a callback function for a Browse button (to select a file) in a GUIDE generated fig:
% --- Executes on button press in browse_pushbutton.
function browse_pushbutton_Callback(hObject, eventdata, handles)
% hObject handle to browse_pushbutton (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
[FileName,PathName] = uigetfile({'*.dat;*.txt','Input Files (*.dat, *.txt)';'*.*','All Files (*.*)'},'Select a file for input');
if ~isequal(FileName,0)
set(handles.path_text,'String',[PathName FileName]);
end
Issue I am having is after I select the file in the uigetfile window and click on open, I get the following error:
Attempt to reference field of non-structure array.
Error in compute_ENOB>browse_pushbutton_Callback (line 302)
set(handles.path_text,'String',[PathName1 FileName1]);
Error in gui_mainfcn (line 96)
feval(varargin{:});
Error in compute_ENOB (line 42)
gui_mainfcn(gui_State, varargin{:});
Error in
@(hObject,eventdata)compute_ENOB('browse_pushbutton_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating uicontrol Callback
I am not sure what is wrong.
1 Comment
Leor Greenberger
on 4 Oct 2011
Accepted Answer
More Answers (0)
Categories
Find more on App Building in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!