I would like to be able to use the uicontrol to update the figure as I scroll with the timestamp information on the x-axis. Also, I would like to be able to access the data as it is updated in order to generate a linked spectorgram of the data in a separate plot beneath the signal. This would allow me to scroll through the time-stamped data and view the spectogram of the data as I scroll through. So far I have only been able to create a scrollbar that allows me to scroll through my data with a specified window size in seconds on the x-axis. Besides adding the time-stamps I still need to access the data in the plot as it is updated by moving the scrollbar. The uicontrol handle is empty for some reason and I can not access the data currently displayed in the time window. Below is the function I have created so far.
function  = SlidingWindowPlot(Signal,Fs,WindowSize)
set(gcf, 'windowstyle', 'docked', 'color' ,'w'); set(gcf,'doublebuffer','on'); grid on
set(a,'xlim',[0 WindowSize]); set(a,'ylim',[-5 5]);
pos=get(a,'position'); Newpos=[pos(1) pos(2)-0.1 pos(3) 0.05];
tmax=max(t); S=['set(gca,''xlim'',get(gcbo,''value'')+[0 ' num2str(WindowSize) '])'];
h=uicontrol('style','slider',... 'units','normalized','position',Newpos,... 'callback',S,'min',0,'max',tmax-WindowSize);