How do i plot a fresh new plot for each iteration without stacking plots? And how do i change the X-direction, so the "flow" seems to come from the opposite direction?
I'm plotting a window of 3 hours seismic data which changes for every iteration. The seismic data is changing every 8 seconds (ideally) as if it was a live feed. When i run the script it plots every iteration on top of each other. I've tried to put the figure command at the top of the whole for-loop, but it doesn't help.
i also want To make the data flow from right to left, and not left to right, i've tried to insert set(gca, 'XDir','reverse'), but it still "feeds" from the right.
for k = 1:length(AAA)/8*sampleRate V=AAA(1+k*8*sampleRate:(3*L)+k*8*sampleRate); v2=flipud(V); %L1=length(v2);
d1 = length(BPPUdpluk); s = 1; output = zeros(round(L/s),d1); tic for i=1:length(v2)-d1 xj2=0; yj2=0; xy2=0; val2=0; for j=1:d1 xj2=xj2+BPPUdpluk(j)*BPPUdpluk(j); yj2=yj2+v2(j+i-1)*v2(j+i-1); xy2=xy2+BPPUdpluk(j)*v2(j+i-1); end % val=xy/(sqrt(xj).*sqrt(yj))
corr3(i)=xy2/(sqrt(xj2)*sqrt(yj2)); end toc corr4 = corr3'; corr4 = flipud(corr4); Udslag(k)=length(corr4(corr4>=0.25)); figure(6) red=zeros(1,length(corr4)); red(:)=0.25; time2 = (0:3/(length(corr3)-1):3); subplot(2,1,1) plot(time2,corr4,'color',[0 0.4470 0.7410]) xlabel('Time[Hr] - 3Hr window') ylabel('CC') %hold on
plot(time2,red,'r') set(gca, 'XDir','reverse') %axis([0 3 -1 1]);
set(gca,'xtick',[]) grid %hold off
if Udslag(k) <=1 hold on subplot(2,1,2) bar(Udslag(k)) set(gca,'Color','g') hold off else if Udslag(k) == 2 hold on subplot(2,1,2) bar(Udslag(k)) set(gca,'Color','y') hold off else hold on subplot(2,1,2) bar(Udslag(k)) set(gca,'Color','r') hold off end endend
Best Answer