Zoom Triggered changes in a plot
5 ビュー (過去 30 日間)
古いコメントを表示
I have a long signal with several annotations. I'd like the annotations to be visible only when I zoom in. Is there a way to do that?
I've tried using a callback function with 'ActionPostCallback':
figure()
%plot the signal
plot(t,fsig);
hold on;
h = zoom;
h.ActionPostCallback = @showpks;
h.Enable = 'on';
function showpks(obj,evd,s)
%mark the peaks
plot (t(pks), fsig(pks), '*');
end
but I'm getting the following warning messege:
Warning: An error occurred during the mode callback.
> In matlab.uitools.internal.uimode/fireActionPostCallback (line 16)
In zoom>local2DButtonUpFcn (line 1383)
In zoom>@(o,e)local2DButtonUpFcn(o,e,hMode,buttonDownData) (line 1134)
In hgfeval (line 62)
In matlab.uitools.internal.uimode/modeWindowButtonUpFcn (line 52)
In matlab.uitools.internal.uimode/setCallbackFcn>localModeWindowButtonUpFcn (line 56)
Is there another way of triggering the appearance of markers when zooming in?
5 件のコメント
Adam
2019 年 10 月 17 日
編集済み: Adam
2019 年 10 月 17 日
h.ActionPostCallback = @showpks;
needs to include the variables you are passing in. I can't remember off the top of my head what arguments that function takes as default, but most callbacks take the source and event data as first two arguments. Assuming they are your h and evd then
h.ActionPostCallback = @(h,evd) showpks( h, evd, t, pks, fsig );
should work as the callback syntax, though there are other syntaxes too.
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Data Exploration についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!