how to create shortcut for "brushing/create new variable"
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (2)
Yair Altman
le 11 Juil 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/
0 commentaires
per isakson
le 10 Juil 2012
Modifié(e) : per isakson
le 10 Juil 2012
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 commentaires
Voir également
Catégories
En savoir plus sur Data Type Identification dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!