how to create shortcut for "brushing/create new variable"

4 views (last 30 days)
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

Answers (2)

Yair Altman
Yair Altman on 11 Jul 2012
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/

per isakson
per isakson on 10 Jul 2012
Edited: per isakson on 10 Jul 2012
Did you search the FEX? You might want to try Graphical data selection tool by John D'Errico.
Below is the result of an experiment I just made. It's primitive but I think it helps.
Download the FEX contribution ALWAYSONTOP by Elmar Tarajan.
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:
It's no point to make bad_data a cell array.

Categories

Find more on Data Type Identification 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!