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

    function con = contable1(cif)
%CONTABLE1  1-D lookup table constraint object
%
%  OBJ=CONTABLE1(CIF)
%
%  CIF must have at least two factors.
%
%  CONTABLE1 objects constrain points according to a 1-D lookup table
%  in the following format:
%
%                               |   Factor
%  Breakpoints:   [vector]      |     N
%  Table values:  [vector]      |     M
%
%  Use "<=" constraint:  0/1
%
%  See also CONBASE.

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

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

if ~nargin
    cif = coninputfactor( 2 );
end

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

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

% Version 1 structure:
%          size: 4
%     breakcols: [-1 -0.5000 0 0.5000 1]
%         table: [1 1 1 1 1]
%       factors: [1 2]
%            le: 1
%       version: 1

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