www.gusucode.com > mbcview 工具箱matlab源码程序 > mbcview/@cgtradeoffgui/@toGVDataModel/getGraphYLimits.m
function lims = getGraphYLimits(obj, R, C) %GETGRAPHYLIMITS Return the appropriate graphing y-limits % % LIMS = GETGRAPHYLIMITS(OBJ, R, C) returns a [ymin, ymax] pair that % should be used for the graph at (R, C). This may be different from the % data's y-limits if zooming is engaged for the graph. % % If C is set to zero, the limits for the graph header will be % supplied if possible. If no limits are available (for example if the % graphs are not currently sharing a y-axis), [NaN NaN] will be returned. % Copyright 2000-2004 The MathWorks, Inc. and Ford Global Technologies, Inc. if obj.useCommonYAxis lims = obj.YLimits(R, :); if C==0 % Check graph zoom status on the first graph C = 1; end if obj.isGraphZoomed(R, C) scale = obj.YZoomScales{R}; lims = i_scalelimits(lims, scale); end else if C==0 lims = [NaN NaN]; else if obj.hasErrorData(R) data = [obj.LowerModelPEBound{R, C}; obj.UpperModelPEBound{R, C}]; else data = obj.ModelValues{R, C}; end lims = mbcmakelimits(data(:), 'loose'); if obj.isGraphZoomed(R, C) scale = obj.YZoomScales{R, C}; lims = i_scalelimits(lims, scale); end end end function lims = i_scalelimits(lims,scale) if ~isempty(scale) % Zoom is on correct axis range = lims(2)-lims(1); lims = lims(1) + scale.*range; end