How do I undo brush data removal in R2019a?
8 views (last 30 days)
Show older comments
MathWorks Support Team
on 10 Jun 2019
Answered: MathWorks Support Team
on 18 Jun 2019
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")?
Accepted Answer
MathWorks Support Team
on 19 Jun 2019
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 Comments
More Answers (0)
See Also
Categories
Find more on Creating, Deleting, and Querying Graphics Objects in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!