Zoom Triggered changes in a plot
9 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Adam
el 17 de Oct. de 2019
Editada: Adam
el 17 de Oct. de 2019
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.
Respuestas (0)
Ver también
Categorías
Más información sobre Data Exploration en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!