New to GUIDE in MATLAB, Frustrated by error...
Show older comments
I am writing my first real GUI in Matlab using GUIDE. I am getting an error message and I believe my syntax is correct. My button press callback is:
% --- Executes on button press in ChooseDiffusionFile.
function ChooseDiffusionFile_Callback(hObject, eventdata, handles)
[DiffFile,DiffFilePath,~]=uigetfile('*.csv');
display(DiffFile)
display(DiffFilePath)
set(handles.DiffFile,'string',DiffFile);
set(handles.DiffFilePath,'string',DiffFilePath);
% hObject handle to ChooseDiffusionFile (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
The error message is:
Reference to non-existent field 'DiffFilePath'.
Error in PlotDataGUI>ChooseDiffusionFile_Callback (line 94)
set(handles.DiffFilePath ,'string', DiffFilePath);
Error in gui_mainfcn (line 96)
feval(varargin{:});
Error in PlotDataGUI (line 42)
gui_mainfcn(gui_State, varargin{:});
Error in
@(hObject,eventdata)PlotDataGUI('ChooseDiffusionFile_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating uicontrol Callback
Line 94 is the line: set(handles.DiffFilePath,'string',DiffFilePath);
I am displaying the variables DiffFile and DiffFilePath so I know they have the correct values. This is frustrating because it looks like everything is correct, but I am still getting the error. Can you help me?
Noel Montgomery
Accepted Answer
More Answers (0)
Categories
Find more on Interactive Control and Callbacks 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!