在MATLAB(R11)中,下面的代码设置回调到线图并且在我缩放或平移轴之前运行良好。之后它不再被触发。怎么了?如何纠正?
function line_callback
figure()
hl = line(randn(1,2),randn(1,2),'ButtonDownFcn',@set_lines); % plot and set callback
function set_lines(cb,eventdata)
lw = get(cb,'LineWidth');% get current line width
set(cb,'LineWidth',lw+1) % increase current line width
答案 0 :(得分:1)
答案是:线路回调未被触发,因为我打开了编辑绘图模式(单击图中的箭头工具)。当激活任何图形工具时,似乎不会触发线回调。 当我取消激活编辑绘图模式时,一切正常。我的错!