www.gusucode.com > mbcexpr 工具箱 matlab 源码程序 > mbcexpr/@cgconconstraint/cgconconstraint.m
function obj = cgconconstraint(name, con, pInp, isLoad) %CGCONCONSTRAINT Create a conbase wrapper object % % OBJ = CGCONCONSTRAINT(NAME, CON, PINP) creates a cgconstraint subclass % that implements a constraint by wrapping a conbase object. % Copyright 2000-2005 The MathWorks, Inc. and Ford Global Technologies, Inc. if nargin==1 && isstruct(name) p = name.cgconstraint; s = rmfield(name, 'cgconstraint'); obj = class(s, 'cgconconstraint', p); else if nargin<1 name = ''; end if nargin<2 con = conlinear; end p = cgconstraint(name); s = struct('ConObject', con, ... 'version', 1); obj = class(s, 'cgconconstraint', p); if nargin>2 if nargin<4 || ~isLoad obj = setinputs(obj, pInp); else % The data is being loaded from an old object and we need to avoid % a full input set operation obj.cgconstraint = setinputs(obj.cgconstraint, pInp); end end end