function Range = yextent(Editor,type)
%YEXTENT  Finds Y extent of visible data.

%   Author(s): P. Gahinet
%   Copyright 1986-2000 The MathWorks, Inc. 
%   $Revision: 1.5 $  $Date: 2000/06/14 20:19:44 $

W = unitconv(Editor.Frequency,'rad/sec',Editor.FrequencyUnits);
HG = Editor.HG;

switch type
case 'mag'
   Xlims = get(HG.PlotAxes(1),'Xlim');
   VisData = Editor.Magnitude(W>=Xlims(1) & W<=Xlims(2));
case 'phase'
   Xlims = get(HG.PlotAxes(2),'Xlim');
   VisData = Editor.Phase(W>=Xlims(1) & W<=Xlims(2));
end

Range = [min(VisData) , max(VisData)];
   