How to clear data from plot in Matlab GUI

조회 수: 306 (최근 30일)
Jonasz
Jonasz 2013년 8월 14일
댓글: Yassir Amhot 2020년 12월 4일
I try clc, clf and nothing works any useful tips?

채택된 답변

Image Analyst
Image Analyst 2013년 8월 14일
편집: Image Analyst 2013년 8월 14일
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
Hunter Pruett
Hunter Pruett 2020년 5월 23일
awesome, thanks so much!
Yassir Amhot
Yassir Amhot 2020년 12월 4일
Holy crap, thank you sooo much

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

추가 답변 (2개)

Azzi Abdelmalek
Azzi Abdelmalek 2013년 8월 14일
You can use cla
  댓글 수: 5
Martin Castillo Yañez
Martin Castillo Yañez 2016년 10월 17일
same issue
Image Analyst
Image Analyst 2016년 10월 18일
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.

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


David Sanchez
David Sanchez 2013년 8월 14일
Try with
clf(handles.my_axis_handle)
where my_axis_handle is the handle of the axis on your GUI.
  댓글 수: 2
Jonasz
Jonasz 2013년 8월 14일
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 2016년 4월 9일
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?

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

카테고리

Help CenterFile Exchange에서 Graphics Objects에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by