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

    function obj = setItem(obj, pItem)
%SETITEM Set the item to be constrained
%
%   OBJ = SETITEM(OBJ, pItem) sets the item (variable or model) that will be
%   constrained by OBJ.
%
%   See also CGTABGRADCONSTRAINT/GETITEM

%   Copyright 2006-2009 The MathWorks, Inc.


if isStaticMode(obj)
    error(message('mbc:cgtabgradconstraint:InvalidState'))
end

if ~isempty(pItem)
    obj.IsVariable = pItem.isinport;
else
    % assume gradient is for a variable
    obj.IsVariable = true;
end
obj.pItem = pItem;