Create a callback that waits for the brush to include some data and then display them
이전 댓글 표시
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?
채택된 답변
추가 답변 (2개)
Giorgos Papakonstantinou
2013년 6월 19일
0 개 추천
댓글 수: 2
Jan
2013년 6월 19일
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
2013년 6월 19일
Andrew Fairgrieve
2021년 10월 1일
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.
카테고리
도움말 센터 및 File Exchange에서 App Building에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!