function TimePanelUpdate(h,option)
% TIMEPANELUPDATE updates the controls in time panel to the current display

% Author: Rong Chen 
% Revised: 
% Copyright 1986-2004 The MathWorks, Inc.

if strcmp(option,'column')
    % populate the index combo
    set(h.Handles.TXTtimeIndex,'String','Time is in Column : ');
    set(h.Handles.COMBtimeIndex,'String',h.GetColumn,'Value',1);
    % populate the unit/format combo
    if isfield(h.IOData.formatcell,'columnIsAbsTime') && h.IOData.formatcell.columnIsAbsTime>=0
        set(h.Handles.TXTtimeSheetFormat,'String','Format : ');    
        set(h.Handles.COMBtimeSheetFormat,'String',h.IOData.formatcell.matlabFormatString);    
        set(h.Handles.COMBtimeSheetFormat,'Value',find(h.IOData.formatcell.matlabFormatIndex == h.IOData.formatcell.columnIsAbsTime));
    else
        set(h.Handles.TXTtimeSheetFormat,'String','Unit : ');    
        set(h.Handles.COMBtimeSheetFormat,'String',{'Years','Weeks','Days','Hours','Mins','Secs'});    
        set(h.Handles.COMBtimeSheetFormat,'Value',6);
    end
else
    set(h.Handles.TXTtimeIndex,'String','Time is in Row : ');
    set(h.Handles.COMBtimeIndex,'String',h.GetRow,'Value',1);
    % populate the unit/format combo
    if isfield(h.IOData.formatcell,'rowIsAbsTime') && h.IOData.formatcell.rowIsAbsTime>=0
        set(h.Handles.TXTtimeSheetFormat,'String','Format : ');    
        set(h.Handles.COMBtimeSheetFormat,'String',h.IOData.formatcell.matlabFormatString);    
        set(h.Handles.COMBtimeSheetFormat,'Value',find(h.IOData.formatcell.matlabFormatIndex == h.IOData.formatcell.rowIsAbsTime));
    else
        % populate the unit/format combo
        set(h.Handles.TXTtimeSheetFormat,'String','Unit : ');    
        set(h.Handles.COMBtimeSheetFormat,'String',{'Years','Weeks','Days','Hours','Mins','Secs'});    
        set(h.Handles.COMBtimeSheetFormat,'Value',6);
    end
end
