function p = getBodePlotOpts(p,h,varargin)
%GETBODEPLOTOPTS Gets plot options of @bodeplot h and assigns them to p 

%  Author(s): C. Buhr
%  Copyright 1986-2005 The MathWorks, Inc.
%  $Revision: 1.1.6.1.2.1 $ $Date: 2005/01/10 00:35:14 $

if isempty(varargin) 
   allflag = false;
else
    allflag = varargin{1};
end

p.FreqUnits = h.AxesGrid.XUnits;
p.FreqScale = h.AxesGrid.XScale{1};
p.MagUnits = h.AxesGrid.YUnits{1};
p.MagScale = h.AxesGrid.YScale{1};
p.PhaseUnits = h.AxesGrid.YUnits{2};

p.MagVisible = h.MagVisible;
p.PhaseVisible = h.PhaseVisible;

if strcmp(h.Preferences.UnwrapPhase,'on')
    p.PhaseWrapping = 'off';
else
    p.PhaseWrapping = 'on';
end

if strcmp(h.Preference.MinGainLimit.Enable,'on')
    p.MagLowerLimMode = 'manual';
else
    p.MagLowerLimMode = 'auto';
end
p.MagLowerLim = h.Preference.MinGainLimit.MinGain;

ComparePhase = h.Preferences.ComparePhase;

p.PhaseMatching = ComparePhase.Enable;
p.PhaseMatchingFreq = ComparePhase.Freq;
p.PhaseMatchingValue = ComparePhase.Phase;


if allflag
    p = getRespPlotOpts(p,h,allflag);
end



