How do I undo brush data removal in R2019a?

3 Ansichten (letzte 30 Tage)
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")?

Akzeptierte Antwort

MathWorks Support Team
MathWorks Support Team am 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

Weitere Antworten (0)

Kategorien

Mehr zu Graphics Object Properties finden Sie in Help Center und File Exchange

Produkte


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by