I've been facing this issue the issue is with axes
2 views (last 30 days)
Show older comments
Usama Marwat
on 18 Jun 2021
Commented: Usama Marwat
on 19 Jun 2021
ERROR:
The class handle has no Constant property or Static method named 'axes1'.
Error in untitled>UPLOADIM_Callback (line 84)
axes(handle.axes1);
Error in gui_mainfcn (line 95)
feval(varargin{:});
Error in untitled (line 42)
gui_mainfcn(gui_State, varargin{:});
Error in matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)untitled('UPLOADIM_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating UIControl Callback.
THE LINE WHERE ERROR IS
function UPLOADIM_Callback(hObject, eventdata, handles)
% hObject handle to UPLOADIM (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
a=uigetfile('.jpg');
a=imread(a);
axes(handle.axes1);
imshow(a);
setappdat(0,'a',a);
0 Comments
Accepted Answer
Steven Lord
on 18 Jun 2021
function UPLOADIM_Callback(hObject, eventdata, handles)
% hObject handle to UPLOADIM (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
a=uigetfile('.jpg');
a=imread(a);
axes(handle.axes1);
The third input to the callback function is named handles (plural).
On the last line of the excerpt of your code I've quoted you're trying to index into something named handle (singular). That's trying to access a property or call a static method on the handle class, and that class has no property or static method named axes1.
To fix this, add the missing s on this last line.
3 Comments
Steven Lord
on 18 Jun 2021
I recommend you post your questions here on Answers. If the questions are about something that's mostly or completely unrelated to this question, please post it as a new discussion (perhaps with a link to this existing question for context.)
More Answers (0)
See Also
Categories
Find more on Graphics Object Programming 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!