www.gusucode.com > mbcdesign 工具箱 matlab 源码程序 > mbcdesign/@conlinear/setLinearForm.m

    function [con, msg] = setLinearForm(con, A, b)
%SETLINEARFORM Property access for linear constraints
%
%  [CON, MSG] = SETLINEARFORM(CON, A, B)
%  [CON, MSG] = SETLINEARFORM(CON, A)
%  [CON, MSG] = SETLINEARFORM(CON, [], B)
%
%  For the lineat constraint this method is just an access method. It
%  sets CON.A = A and CON.b = B. 
%
%  See also CONLINEAR, CONLINEAR/GETLINEARFORM.

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

msg = {};

if ~isempty( A ),
    if length( A ) == length( con.A ),
        con.A = A;
    else
        msg(end+1)={'Coefficient vector A is too long'};
    end
end

if nargin >= 3 && ~isempty( b ),
    if length( b ) == 1,
        con.b = b;
    else
        msg(end+1) = {'Incorrect size for b'};
    end
end

con = pUpdateScaleFactor( con );

%------------------------------------------------------------------------------|
% EOF
%------------------------------------------------------------------------------|