Create a callback that waits for the brush to include some data and then display them
Afficher commentaires plus anciens
I have the following simple example:
x=-4:0.1:4;
y= x.^2-1;
f=figure;
h=plot( x, y );
bO = brush(gcf);
set(bO,'enable','on');
data=logical(get(h,'brushdata'));
disp(data)
If I run it all the data will be zero. If I run it until the set command, choose subsequently the data from the plot and then continue with executing the other two commands the selected data will be displayed.
How can I control with the callback to wait until I gather the data and then display them?
Réponse acceptée
Plus de réponses (2)
Giorgos Papakonstantinou
le 19 Juin 2013
0 votes
2 commentaires
Jan
le 19 Juin 2013
Please do not bump your question after a short period of time. The contributors of this forum answer, when they find the time and know a solution. If the question is bumped to the top without really new informations, reading it another time wastes the time of the voluntary helpers.
Please use the answer section for answers only. Comments about the question are better inside the comment section of the question. Thanks.
Giorgos Papakonstantinou
le 19 Juin 2013
Andrew Fairgrieve
le 1 Oct 2021
Its not a pretty solution but it seems to work:
b=brush;
b.Enable = 'on';
waitfor(b,'Enable','off')
This will cause the script to wait for the user to turn off the brush, before continuing with the rest of the script. If the user has used the brush to delete points,
~isnan(PlotHandle.YData)
, can then be used to identify data the user has deleted and then this can be applied to related data in the script.
Catégories
En savoir plus sur Characters and Strings dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!