How do I undo brush data removal in R2019a?

조회 수: 7 (최근 30일)
MathWorks Support Team
MathWorks Support Team 2019년 6월 10일
답변: MathWorks Support Team 2019년 6월 18일
I am using the brushing tool to select a set of points on my plot, and then remove all of the unbrushed points (with right-click > "Remove Unbrushed").
After removing these points, I want to later revert to the state of the original graph. Is there a way to undo all of the data removals from the brush tool (such as "brush undo" or "brush reset")?

채택된 답변

MathWorks Support Team
MathWorks Support Team 2019년 6월 19일
There is not a builtin function specifically to undo data removal from brushing. However, one of the following workarounds may work for you:
1. The simplest way to reset your graph would be to click the general 'undo' button for the figure (under 'Edit'). If you backtrack to when you removed the unbrushed points, you can restore the original graph.
2. You could write your own 'brush undo' function to restore the original graph.
When you delete data with the brush tool, the associated 'YData' of the plot is changed to NaN values. Thus, the data cannot be automatically restored without using the general 'undo' button. However, you could work around this by writing a function which resets the 'YData' to the original graph data. For example:
function undoBrush(h, data)
% h is a handle to the line containing the deleted data
% data is the original y data used to make the plot
h.YData = data;
end

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by