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

    function con = contable2( cif )
%CONTABLE2  2-D lookup table constraint object
%
%  OBJ=CONTABLE1(CIF)
%
%  CIF must have at least three factors.
%
%  CONTABLE2 objects constrain points according to a 2-D lookup table
%  in the following format:
%
%                               |   Factor
%  Breakpoints: X  [vector]     |     I
%  Breakpoints: Y  [vector]     |     J
%  Table values:  [matrix]      |     K
%  
%  Use "<=" constraint:  0/1
%
%  See also CONBASE.

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

% Default number of breakpoint to use in the table
NBREAKS = 5;

if ~nargin
    cif = coninputfactor( 3 );
end

if isstruct( cif ),
    parent = cif.conbase;
    con = mv_rmfield( cif, 'conbase' );
else
    if length( cif ) < 3,
        error(message('mbc:contable2:InvalidArgument'));
    end
    parent = conbase( cif );
    parent = setActiveIndices( parent, [1, 2, 3] );
    
    con.breakcols = linspace( cif(1).Min, cif(1).Max, NBREAKS );
    con.breakrows = linspace( cif(2).Min, cif(2).Max, NBREAKS );
    con.table = repmat( cif(3).Max, NBREAKS, NBREAKS );
    con.le = 1; % Can't use logical because xreginterp1d needs doubles
    con.version = 3;
    con.UserData = [];

end

con = class( con, 'contable2', parent );

%------------------------------------------------------------------------------|
% Version 1 structure
%    c.size=max(sz,2);
%    c.breakcols=(-1:0.5:1);
%    c.breakrows=(-1:0.5:1);
%    c.table=ones(5,5);
%    c.factors=[1 2 3];
%    c.le=1;
%    c.version=1;

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