visually time shift individual data trace within a group

7 visualizaciones (últimos 30 días)
Pascal Galloway
Pascal Galloway el 6 de Abr. de 2011
Hi All,
I have a query regarding time shifting of data. If, for example, I have three time traces within a single matlab plot, I can shift them individually using:
hold on; plot(x(1:end-20),y(21:end,1),'b'); plot(x(:),y(:,2),'g'); plot(x(1:end-25),y(26:end,3),'r');
Is there a faster method of visual inspection/comparison using the 'pan' button in the 'figure properties' options to move ONLY ONE trace and not all three??
I essentially want to get the best correlation you could say between the three traces by visual inspection
Thanks

Respuestas (2)

Walter Roberson
Walter Roberson el 6 de Abr. de 2011
pan applies to everything in the selected axes. You could put your traces in to separate axes and pan the one you want, but it might perhaps be tricky to select the axes to pan unless you put in some kind of button to activate a particular one.

Pascal Galloway
Pascal Galloway el 15 de Abr. de 2011
Thanks for the answer. I have opted for the original method, I'm not prepared to attempt to code a button for this, it would take me AGES! Thanks anyway.
  2 comentarios
Walter Roberson
Walter Roberson el 15 de Abr. de 2011
The button code would be fairly simple:
You would first create the axis handles ahead of time. Don't worry about their positions or properties to start with:
axishandles = [axes;axes;axes]; %three new axes
uicontrol('Style','radio','Position',LOCATIONS(1,:),'Callback',{@axonoff, axishandles(1)});
uicontrol('Style','radio','Position',LOCATIONS(2,:),'Callback',{@axonoff, axishandles(2)});
uicontrol('Style','radio','Position',LOCATIONS(3,:),'Callback',{@axonoff, axishandles(3)});
function axonoff(src, event, axhandle)
onoff = {'off','on'};
if ishandle(axhandle)
newstate = onoff{1 + get(src,'Value')};
set(axhandle, 'Hittest', newstate);
end
Then in your main program when you decide where the trace K should go on the figure, set() the Position property of axishandles(K), and when you plot() that trace, specify axishandles(K) as the parent axis for the relevant plot commands, such as
plot(axishandles(K),x,y)
Pascal Galloway
Pascal Galloway el 5 de Mayo de 2011
I will feed back if I implement this code, it may be useful to others?

Iniciar sesión para comentar.

Categorías

Más información sobre Labels and Annotations en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by