【问题标题】:Linked cursorbar over subplots子图上的链接光标栏
【发布时间】:2016-04-07 07:45:19
【问题描述】:

在下图中,我使用两个光标栏放置了两个子图:

 figure;
 t=0:.01:7;
 subplot(2,1,1)
 hp1=plot(t,sin(t));
 hCursorbar1 = graphics.cursorbar(hp1); drawnow
 subplot(2,1,2)
 hp2=plot(t,cos(t));
 hCursorbar2 = graphics.cursorbar(hp2); drawnow

目前,当我将光标条移入一个子图时,它不会影响另一个子图中的另一个光标条。

我想在两个光标栏之间建立链接,这样当我移动一个光标栏(右\左)时,它也会在另一个子图上移动另一个光标栏。

有可能吗?

【问题讨论】:

    标签: matlab matlab-figure


    【解决方案1】:
    lis1=addlistener ( hCursorbar1,'Location','PostSet', ...
                @(~,~)set(hCursorbar1,'Location',hCursorbar2.Location));
    lis1=addlistener ( hCursorbar2,'Location','PostSet', ...
                @(~,~)set(hCursorbar2,'Location',hCursorbar1.Location));
    

    cf:cursorbar.m fileexchange & cursorbar undocomentedmatlab

    希望这会有所帮助 =)

    【讨论】:

    • 感谢您的回答。目前我有 2011b Matlab。我希望它很快会更改为 R2015b。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-07-29
    • 1970-01-01
    • 2015-03-25
    • 1970-01-01
    • 2015-06-14
    • 2022-01-09
    • 2013-10-17
    相关资源
    最近更新 更多