How do I undo brush data removal in R2019a?

8 次查看(过去 30 天)
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
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