visually time shift individual data trace within a group
7 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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
0 commentaires
Réponses (2)
Walter Roberson
le 6 Avr 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.
0 commentaires
Pascal Galloway
le 15 Avr 2011
2 commentaires
Walter Roberson
le 15 Avr 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)
Voir également
Catégories
En savoir plus sur Labels and Annotations dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!