www.gusucode.com > mbcexpr 工具箱 matlab 源码程序 > mbcexpr/@cglookup/addToExtrapolationRegions.m
function obj = addToExtrapolationRegions(obj, varargin) %ADDTOEXTRAPOLATIONREGIONS Add table cells to the extrapolation regions mask % % OBJ = ADDTOEXTRAPOLATIONREGIONS(OBJ, ROW, COL) adds the specified table % cell to the extrapolation regions mask. ROW and COL can be vectors of % the same length, N, in which case they will specify N cells to add to % the mask. % % OBJ = ADDTOEXTRAPOLATIONREGIONS(OBJ, ROW) adds table cells to the % regions mask of a 1D table. % % OBJ = ADDTOEXTRAPOLATIONREGIONS(OBJ, ROW, COL, DIM3, ...DIMn) adds table % cells to an nD table. % % If all of the trailing dimension values are set to 1, then a % higher-dimensional call will work on lower dimensional tables. For % example this means that a regions mask on a 1D table can be altered with % the same syntax as that used for a 2D table. % Copyright 2000-2004 The MathWorks, Inc. and Ford Global Technologies, Inc. L = cellfun('prodofsize', varargin); if any(L-L(1)) error(message('mbc:cglookup:InvalidSize3')); end nDims = getNumAxes(obj); if length(L)<nDims error(message('mbc:cglookup:InvalidArgument')); end mask = getExtrapolationRegions(obj); if L(1)==1 mask(varargin{1:nDims}) = true; elseif L(1)>1 idx = sub2ind(size(mask), varargin{1:nDims}); mask(idx) = true; end if L(1)>0 obj = pSetExtrapolationRegions(obj, mask); end