how to create shortcut for "brushing/create new variable"
4 次查看(过去 30 天)
显示 更早的评论
I brush out bad data points in plots and assign them to a "bad" data variable. I do this using the brush tool -> Tools -> Brushing -> Create New Variable and call the variable "bad"
This works great but is very cumbersome and repetitive in the GUI with the pull down menu... Is there a way to create a shortcut or shortcut button to accomplish this task in one click? would the button reside in the command window pane, or the figure panes? how can I do this?
Many thanks for any help here.
OSX lion matlab 2011b
0 个评论
回答(2 个)
Yair Altman
2012-7-11
You might find the following article relevant in your search for programmatic access to plot data-brushing: http://UndocumentedMatlab.com/blog/accessing-plot-brushed-data/
0 个评论
per isakson
2012-7-10
编辑:per isakson
2012-7-10
Below is the result of an experiment I just made. It's primitive but I think it helps.
Interactive steps
alwaysontop('auto')
plot( your_data ) % it doesn't work with scatter
click the alwaysontop icon and run in the base workspace
bad_data = cell(0);
graph_handle = findobj( gcf, '-property', 'BrushData' );
Select some points with the brushing tool and run the command
bad_data = cat( 1, bad_data, { get( graph_handle, 'BrushData' ) } );
Select more points and double click the command above in the command history. Putting it in a shortcut doesn't really help much. I don't think it is possible to bind a command to a keystroke-shortcut. Run the command
is_bad = any( cell2mat( bad_data ), 1 );
Now is_bad indicates all points selected as bad.
The code could be put in a script with each group of commands in a separate cell. The the code can be run by clicking [Evaluate Cell].
This is a first step towards something better.
--- Cont. ---
I've made two observations:
- the approach described above works with scatter if the number of point is less than 100. See "Undocumented scatter plot behavior" at Undocumented Matlab
- "graph_handle = findobj( gcf, '-property', 'BrushData' );" started to return empty. After restarting Matlab it works again.
It's no point to make bad_data a cell array.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Type Identification 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!