www.gusucode.com > mbcexpr 工具箱 matlab 源码程序 > mbcexpr/@cglookup/anyExtrapolationRegions.m

    function ret = anyExtrapolationRegions(obj, varargin)
%ANYEXTRAPOLATIONREGIONS Check whether any cells are in the extrapolation mask
%
%  IN_MASK = ANYEXTRAPOLATIONREGIONS(OBJ) returns true if there are any
%  table cells marked as being in the extrapolation regions mask.
%
%  IN_MASK = ANYEXTRAPOLATIONREGIONS(OBJ, ROW, COL) where ROW and COL are
%  scalars checks whether the cell at (ROW, COL) is in the extrapolation
%  regions mask.
%
%  IN_MASK = ANYEXTRAPOLATIONREGIONS(OBJ, ROWRANGE, COLRANGE) where
%  ROWRANGE and COLRANGE are (1-by-2) vectors defining min and max bounds
%  of a rectangular region in the mask checks whether there are any cells
%  in the defined region that are in the extrapolation regions mask.  
%
%  IN_MASK = ANYEXTRAPOLATIONREGIONS(OBJ, DIM1, DIM2, ..., DIMn) where DIMn
%  is a scalar or range for each input axis of the table checks for cells
%  in the regions mask of a multi-dimensional table.

%  Copyright 2000-2004 The MathWorks, Inc. and Ford Global Technologies, Inc.


% Can shortcut if the ExtrapolationRegions field is empty (== all false)
ret = ~isempty(obj.ExtrapolationRegions);
if ret
    mask = getExtrapolationRegions(obj);
    if nargin==1
        ret = any(mask(:));
    else
        if isscalar(varargin{1})
            ret = mask(varargin{:});
        else
            S = substruct('()', cell(1, length(varargin)));
            for m = 1:length(varargin)
                S.subs{m} = varargin{m}(1):varargin{m}(2);
            end
            sub_mask = subsref(mask, S);
            ret = any(sub_mask(:));
        end

    end
end