David - it is my understanding that whenever the plot function is invoked, then it resets certain properties of the axes that it is being displayed upon, including the axes limits. Your observed behaviour can be reproduced with the following code
x = -2*pi:0.0001:2*pi;
y1 = sin(x);
y2 = cos(x);
figure;
plot(gca,x,y1);
set(gca,'xlim',[-2 2],'XLimMode','Manual');
plot(gca,x,y2); % and the original axes limits are restored!
One way to avoid this is to use the hold on command which will maintain the axes limits, but unfortunately will keep data that was previously plotted.
An alternative to invoking plot for each of your three axes at each iteration of the while loop, is to just call plot the once (for each axes) and then reset the x and y data at each iteration. There are two benefits to this - you are not calling plot and so the axes limits are maintained, and you are not creating three new graphics handles with each plot made.
From the example sine and cosine example, we can do the following
x = -2*pi:0.0001:2*pi;
y1 = sin(x);
y2 = cos(x);
figure;
h = plot(gca,NaN,NaN,'b'); % nothing is plotted but we now have a handle
set(h,'XData',x,'YData',y1);
set(gca,'xlim',[-2 2],'XLimMode','Manual');
set(h,'XData',x,'YData',y2); % and the current axes limits are maintained!
In your case, outside of your while loop, you would do
hPlotL = plot(axL,NaN,NaN,'k');
hPlotR = plot(axR,NaN,NaN,'k');
hPlotRast = plot(axRast,NaN,NaN,ploco(ico)); % may need to compensate for ploco(ico)?
And then within the while loop do
set(hPlotL,'XData',x1,'YData',y1);
set(hPlotR,'XData',x2,'YData',y2);
set(hPlotRast,'XData',X,'YData',Y);
Try the above and see what happens!
