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

    function ret = anyExtrapolationMask(obj, varargin)
%ANYEXTRAPOLATIONMASK Check whether any cells are in the extrapolation mask
%
%  IN_MASK = ANYEXTRAPOLATIONMASK(OBJ) returns true if there are any table
%  cells marked as being in the extrapolation mask.
%
%  IN_MASK = ANYEXTRAPOLATIONMASK(OBJ, ROW, COL) where ROW and COL are
%  scalars checks whether the cell at (ROW, COL) is in the extrapolation
%  mask.
%
%  IN_MASK = ANYEXTRAPOLATIONMASK(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 mask.  
%
%  IN_MASK = ANYEXTRAPOLATIONMASK(OBJ, DIM1, DIM2, ..., DIMn) where DIMn is
%  a scalar or range for each input axis of the table checks for cells in
%  the mask of a multi-dimensional table.

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


% Can shortcut if the ExtrapolationMask field is empty (== all false)
ret = ~isempty(obj.ExtrapolationMask);
if ret
    mask = getExtrapolationMask(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