www.gusucode.com > mbcdata 工具箱 matlab 源码程序 > mbcdata/@cgtabgradconstraint/setFilterGridFcn.m

    function obj = setFilterGridFcn(obj, filterGridFcn)
%SETFILTERGRIDFCN Set the filter grid function handle
%
%   OBJ = SETFILTERGRIDFCN(OBJ, FILTERGRIDFCN) sets the function
%   that will filter the table grid points to be used in calculating the
%   constraint.
%
%   OBJ = SETFILTERGRIDFCN(OBJ, 'CONVEXHULL') sets the filter function to
%   be the built in convex hull filter function.
%
%   OBJ = SETFILTERGRIDFCN(OBJ, 'IDENTITY') sets the filter function to
%   be the built in identity filter function. This filter allows all grid
%   points to be part of the constraint.
%
%   See also CGTABGRADCONSTRAINT/GETFILTERGRIDFCN

%   Copyright 2006-2007 The MathWorks, Inc.

if ischar(filterGridFcn)
    switch lower(filterGridFcn) 
        case 'convexhull'
            obj.FilterGridFcn = @pConvHullGridFilter;
        case 'identity'
            obj.FilterGridFcn = @pIdentityGridFilter;
        otherwise
            error(message('mbc:cgtabgradconstraint:InvalidArgument1'));
    end
else
    obj.FilterGridFcn = filterGridFcn;
end

% Reset the working store if in static mode
if isStaticMode(obj)
    obj.WorkingStore.resetWorkingStore();
end