clickableLegend示例错误-超出数组元素数0

问题描述

我正在尝试在Matlab 2019b上的脚本中获得可点击的图例,其插件来自此处https://de.mathworks.com/matlabcentral/fileexchange/21799-clickablelegend-interactive-highlighting-of-data-in-figures。但这只会给我以下错误

Index exceeds the number of array elements (0).

Error in clickableLegend (line 99)
    set(objhan(i),'HitTest','on','ButtonDownFcn',...

即使示例1或2都不起作用:

Example 1:
z = peaks(100);
plot(z(:,26:5:50))
grid on;
axis manual;
clickableLegend({'Line1','Line2','Line3','Line4','Line5'},'Location','northWest');

Example 2:
f = plot([1:10;1:2:20]','x'); hold on;
g = plot(0:.1:10,sin([0:.1:10;0:.2:20]'),'r-');
h = plot(11:20,rand(5,10)*5,'b:');
clickableLegend([f;g;h],{'Line1','Line3'},...
'groups',[1 1 2 2 3 3 3 3 3],'displayedLines',[2 3]);

有人可以在这里帮助我吗?由于对Matlab的有限经验,我有点迷失了:/

问候帕特里克

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)