matlab gui error using axes invalid object handle

function spectrograma_Callback(hObject, eventdata, handles)
% hObject handle to spectrograma (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%spectrograma primul semnal cu zgomot
a=get(handles.semnal_ideal,'Value')
if a==1
q=spectrograma_semnal_ideal(0.9)
axes(handles.axes5)
plot3(q(1),q(2),q(3),'r*','MarkerSize',10)
hold on
else
b=get(handles.zgomot,'String');
zgomot=str2double(b);
for i=1:50
[solutii(i,:),output(i)]=spectrograma_semnal_zgomot(0.9,zgomot);
end
solutii_bune=find(output==1);
pozitia_sursei=sum(solutii(solutii_bune,:))/size(solutii_bune,2);
axes(handles.axes5)
plot3(pozitia_sursei(1),pozitia_sursei(2),pozitia_sursei(3),'r*','MarkerSize',10);
hold on
end
I have to make a interface and i'm stuck at this error. This error give me headaches and i can't solve it
Error using axes
Invalid object handle
can anyone help me?

답변 (1개)

Jan
Jan 2018년 3월 22일

0 개 추천

axes(handles.axes5) fails, if handles.axes5 is not a valid axes object. Where did you create and define it? Has it been deleted? Did you overwrite the field in the handles struct?

댓글 수: 5

Jessie Bessel
Jessie Bessel 2018년 3월 22일
편집: Jessie Bessel 2018년 3월 22일
I plot many graphics on the same figure and i think that is the problem; something is not right. handle.axes5 is a valid axes.
Jan
Jan 2018년 3월 24일
편집: Jan 2022년 7월 18일
The error message is clear: "Error using axes - Invalid object handle". This means, that the handle is not valid. Use the debugger to check this.
if
axes5
else
axes5
same thing here,how did you fix this.SOS
Jan
Jan 2022년 7월 18일
@x Wang: The code is strange. What do you expect "axes5" to be? A command or variable?
I cannot fix code, if its purpose is unclear and this is not even a valid Matlab syntax.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기

질문:

2018년 3월 22일

댓글:

Jan
2022년 7월 18일

Community Treasure Hunt

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

Start Hunting!

Translated by