function ViewerObj = initparams(ViewerObj,ExtraArg,plottype);
%INITPARAMS  Store extra input arguments from LTI Viewer initialization
%
%   ViewerObj = INITPARAMS(ViewerObj,ExtraArg,PLOTTYPE) stores the
%   extra input arguments in the cell array ExtraArg in the appropriate
%   LTI Viewer properties in ViewerObj. The contents of ExtraArg is 
%   determined based on the type of response being plotted, as indicated
%   by the string PLOTTYPE.

%   Authors: Karen Gondoly, 4-14-98
%   Revised: Adam DiVergilio
%   Copyright 1986-2000 The MathWorks, Inc. 
%   $Revision: 1.7 $  $Date: 2000/06/14 20:03:12 $

switch plottype
case {'step','impulse'}
   ViewerObj.Preferences.TimeVectorMode = 'manual';
   ViewerObj.Preferences.TimeVector = ExtraArg{1};

case 'initial'
   ViewerObj.InitialCondition= ExtraArg{1};
   if length(ExtraArg)>1
      ViewerObj.Preferences.TimeVectorMode = 'manual';
      ViewerObj.Preferences.TimeVector = ExtraArg{2};
   end

case 'lsim'
   ViewerObj.InputSignal.Value = ExtraArg{1};
   if length(ExtraArg)>1
      ViewerObj.InputSignal.Time = ExtraArg{2};
   else
      ViewerObj.InputSignal.Time = [];
   end
   if length(ExtraArg)>2
      ViewerObj.InputSignal.IC = ExtraArg{3};
   else
      ViewerObj.InputSignal.IC = [];
   end

case {'bode','bodemag','nyquist','nichols'}
   ViewerObj.Preferences.FrequencyVectorMode = 'manual';
   ViewerObj.Preferences.FrequencyVector = ExtraArg{1};

case 'sigma'
   if ~isempty(ExtraArg{1})
      ViewerObj.Preferences.FrequencyVectorMode = 'manual';
      ViewerObj.Preferences.FrequencyVector = ExtraArg{1};
   end

   if length(ExtraArg)>1
      ViewerObj.SingularValueType = ExtraArg{2};
   end

end
