How to clear data from plot in Matlab GUI

 Respuesta aceptada

Image Analyst
Image Analyst el 14 de Ag. de 2013
Editada: Image Analyst el 14 de Ag. de 2013
Perhaps try this:
axes(handles.averSpec); % Make averSpec the current axes.
cla reset; % Do a complete and total reset of the axes.
If you want to clear just the curve, bars, surfaces, or whatever you plotted, and not the labels, tick spacing etc., then get the handle to it when you created it and then delete it
hPlotData = plot(....... whatever
% Now get rid of it.
delete(hPlotData);

7 comentarios

Jonasz
Jonasz el 14 de Ag. de 2013
I don't know but it didn't work.
Jhonantans Rocha
Jhonantans Rocha el 25 de Ag. de 2014
Man, it really helped me! Thanks!
Image Analyst
Image Analyst el 26 de Ag. de 2014
You're welcome. Can you go ahead and mark my Answer as "Accepted" then?
Robert
Robert el 9 de Abr. de 2016
This worked for me.
thanks man you saves the world
Hunter Pruett
Hunter Pruett el 23 de Mayo de 2020
awesome, thanks so much!
Yassir Amhot
Yassir Amhot el 4 de Dic. de 2020
Holy crap, thank you sooo much

Iniciar sesión para comentar.

Más respuestas (2)

Azzi Abdelmalek
Azzi Abdelmalek el 14 de Ag. de 2013

2 votos

You can use cla

5 comentarios

Jonasz
Jonasz el 14 de Ag. de 2013
Editada: Azzi Abdelmalek el 14 de Ag. de 2013
I am using and nothing ..
function clear_Callback(hObject, eventdata, handles)
% hObject handle to clear (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
cla(handles.averSpec);
This is starting when you press ' clear' button
Azzi Abdelmalek
Azzi Abdelmalek el 14 de Ag. de 2013
Is there any error message ?
Jonasz
Jonasz el 14 de Ag. de 2013
No but nothing happen plot stays the same.
same issue
If you tried my answer of using
cla reset;
and that did not wipe the axes totally clean, down to a white rectangle with axes in the 0-1 range, then call the Mathworks because your cla function is corrupted. Or you've overwritten it with your own function called cla.

Iniciar sesión para comentar.

David Sanchez
David Sanchez el 14 de Ag. de 2013
Try with
clf(handles.my_axis_handle)
where my_axis_handle is the handle of the axis on your GUI.

2 comentarios

Jonasz
Jonasz el 14 de Ag. de 2013
It clear all the figure except my axis I want to clear. But i want to clear the data not the whole axis.
Robert
Robert el 9 de Abr. de 2016
This is exactly what happened to me. When i used this line it cleared everything except what i wanted it to clear. When i type in the handle of the axes i want to clear that is the only one it left alone and cleared the rest of the guy. Any ideas?

Iniciar sesión para comentar.

Categorías

Más información sobre Creating, Deleting, and Querying Graphics Objects en Centro de ayuda y File Exchange.

Productos

Preguntada:

el 14 de Ag. de 2013

Comentada:

el 4 de Dic. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by