Problem with axes and animatedline
10 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi! My problem is that when I try to plot an animatedline into axis1, instead of plotting there, another window is opened. also, when I try to use axes(handles.axes1) it says:
ans =
handle to deleted Axes.
Mi code is here:
function Medir_Callback(hObject, eventdata, handles)
s = abrir_puerto();
handles.x=1:20;
handles.h=animatedline('Marker','o','LineWidth',1,'Color','k');
for i=1:(length(handles.x))
handles.distancia(i)=fscanf(s,'%d');
addpoints(handles.h,i,handles.distancia(i));
drawnow;
end
cerrrar_puerto(s);
I want it to be plotted in my Matlab GUI. Although i have tried to define axes in here, i haven't been able to fix the error that appears below
handles.h=animatedline('Marker','o','LineWidth',1,'Color','k','Parent', handles.axes1);
Error using animatedline While setting property 'Parent' of class 'AnimatedLine': Cannot set property to a deleted object
Thanks, Itziar
0 Commenti
Risposte (1)
Adam
il 23 Feb 2017
Modificato: Adam
il 23 Feb 2017
The problem here is not with the animated line plotting it is what you post at the top - that your axes no longer exist. That is why it creates a new axes when you don't specify one and why it throws an error when you do.
Judging by the name of your axes I assume they are axes defined in GUIDE? If so I'm not sure how you would end up deleting the axes. You should search through your code for any instruction that involves handles.axes1 and check that you are not explicitly deleting the axes. Axes in a GUIDE GUI have the same life time as the GUI itself unless you explicitly delete them.
I notice though also that your callback does not include a
guidata( hObject, handles )
call so any changes you make to the handles structure there will be lost after the callback. That in itself is not the cause of this particular problem, but it is a hint that you might have done something incorrect with the handles structure previously also.
Vedere anche
Categorie
Scopri di più su Animation in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!