How to delete a plot in UIAxes?
조회 수: 6 (최근 30일)
이전 댓글 표시
I'm using a button as a tool to plot one linear fit over a curve and I would like to replace the plot of the fit whenever I push the button again. I'm not quite sure how to use the delete command in this case. Any help is appreciated :)
댓글 수: 0
채택된 답변
David J. Mack
2017년 10월 3일
편집: David J. Mack
2017년 10월 3일
You could store the handle to the fitted line in the UserData of the figure and then retrieve it every time the button is hit and use it to replace the YData of the line with the new fitted YData (this "replaces" the old line). Greetings, David
댓글 수: 2
David J. Mack
2018년 2월 7일
hFig = figure(); hPlot = plot(cfit); hFig.UserData.hPlot = hPlot; % Code to add the button
% in your callback hFig.UserData.hPlot.YData = newYData;
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!