I'm trying to create a sliding window (with a slider) to view multiple subplots each of which is a long time series.
S=['set(gca,''xlim'',get(gcbo,''value'')+[0 ' num2str(chunkDuration) '])'];
h=uicontrol('style','slider','units','normalized','position',Newpos,...
'callback',S,'min',0,'max',xmax-chunkDuration);
As written, this only causes the bottom plot to move. I understand that's because I set gca
. However, changing gcf
to gca
won't help because that would try to set the xlim
of figure instead of its children.
When I try
kids = get(gcf,'Children')
S=['set(kids,''xlim'',get(gcbo,''value'')+[0 ' num2str(chunkDuration) '])'];
I get the error:
??? Undefined function or variable 'kids'.
??? Error while evaluating uicontrol Callback
So, why doesn't the above work?
Even after a substantial change in approach, the problems remain.