visually time shift individual data trace within a group
7 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (2)
Walter Roberson
am 6 Apr. 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 Kommentare
Pascal Galloway
am 15 Apr. 2011
2 Kommentare
Walter Roberson
am 15 Apr. 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)
Siehe auch
Kategorien
Mehr zu Labels and Annotations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!