Create a callback that waits for the brush to include some data and then display them
Mostrar comentarios más antiguos
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?
Respuesta aceptada
Más respuestas (2)
Giorgos Papakonstantinou
el 19 de Jun. de 2013
0 votos
2 comentarios
Jan
el 19 de Jun. de 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
el 19 de Jun. de 2013
Andrew Fairgrieve
el 1 de Oct. de 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.
Categorías
Más información sobre Characters and Strings en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!