필터 지우기
필터 지우기

setting WindowButtonMotionFcn to several subplots. Later command set(gcf, 'WindowBut​tonMotionF​cn'...) work only for last suplot

조회 수: 2 (최근 30일)
Hi
I have a figure with 2 subplot
f=figure
subplot(2,1,1)
plot(...)
% Then I set WindowButtonMotionFcn with my function highlightPlot_1
set(gcf, 'WindowButtonMotionFcn', @(src,event)highlightPlot_1(hittest(src)));
% if I make a breackpoint here, it works for 1st subplot
% Then I plotting another subplot
subplot(2,1,2)
plot(...)
%and again set WindowButtonMotionFcn with my another function highlightPlot_2
set(gcf, 'WindowButtonMotionFcn', @(src,event)highlightPlot_2(hittest(src)));
% at the end WindowButtonMotionFcn works only for 2nd subplot. It seems like 2nd set(gcf, ...) command overwrites previous one.
% And I understood that I cannot set WindowButtonMotionFcn for specific subplot?
So is it possible to have two working WindowButtonMotionFcn for each of subplot?
...You can say like separate subplots to two figures - prabably it will work but I want to have it in subplots.
Thanks!

답변 (0개)

카테고리

Help CenterFile Exchange에서 Subplots에 대해 자세히 알아보기

제품


릴리스

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by