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

    function con = setTable(con, xBreakpoints, yBreakpoints, table)
%SETTABLE Set the breakpoints and values for the table
%
%  CON = SETTABLE(CON, XBREAKPOINTS, YBREAKPOINTS, TABLE)
% 
%  The sizes of XBREAKPOINTS, YBREAKPOINTS and TABLE must agree in the sense that 
%
%       size( TABLE ) = [numel( YBREAKPOINTS ), numel( XBREAKPOINTS )];
%
%  As with everything with constraints, there is no coding so both should be in
%  natural or engineering units. 
%
%  See also CONTABLE2, CONTABLE2/GETTABLE.

%  Copyright 2000-2005 The MathWorks, Inc.

% We want to keep the breakpoints as rows.
xBreakpoints = xBreakpoints(:).';
yBreakpoints = yBreakpoints(:).';

% The number of break points must agree with the size of the table
if ~all( size( table ) == [numel( yBreakpoints ), numel( xBreakpoints )] ),
    error(message('mbc:contable2:InvalidArguments'));
end
    
% Set the properties of the model
con.breakcols = xBreakpoints;
con.breakrows = yBreakpoints;
con.table     = table;

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