Show older comments
Hello
Here is matlab code that I am using to plot (analog and ttl signals of a waveform) and pan across the x-axis of the plot.
dsig = csvread('digital 1030 50Mhz 5M.csv',0,3);
asig = csvread('analog 1030 50Mhz 5M.csv',0,3);
%tim =sig(1:1000000,1);
damp = dsig(1:5000000,2);
aamp = asig(1:5000000,2);
ts = dsig(2,1) - dsig(1,1);
tim = [0:5000000 - 1]*ts;
time = tim';
subplot(2,1,1), plot(time, aamp);
subplot(2,1,2), plot(time, damp);
axis([0 max(tim) -0.1 1.5]);
ax_handle = gca;
xlimit_orig = get(ax_handle, 'Xlim');
win_xlimit = [0 0.0001];
offset = 0.0001;
%Iterativley change the xlimit for the axes to pan across the figure
while win_xlimit(2) <= xlimit_orig(2)
set(ax_handle, 'Xlim', win_xlimit);
pause(0.5);
w = waitforbuttonpress;
if w == 1
win_xlimit = win_xlimit + offset;
end
end
GCA seems to return axis handles to one of the plots. The panning works fine if I just plotted one signal and didn't use subplot. How can I pan across both plots using subplot?
Thanks
Accepted Answer
More Answers (0)
Categories
Find more on Graphics Object Properties in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!