www.gusucode.com > mbcexpr 工具箱 matlab 源码程序 > mbcexpr/@cglookupone/cglookupone.m
function p = cglookupone(name,varargin) %CGLOOKUPONE Constructor for 1-D look up table class % % lt = CGLOOKUPONE returns an empty cglookupone object % lt = CGLOOKUPONE('name',M,X,v) returns a xregpointer to a cglookupone % object. % M - lookup table values - [n 2] array of doubles % X - input argument of the table - xregpointer to expression % v - clip points - [cliplow,cliphigh] doubles % The breakpoints field will be the first column of M and the values field % will be the second column of M. % Copyright 2000-2013 The MathWorks, Inc. and Ford Global Technologies, Inc. if nargin==0; e = cgnormfunction; %version 1 created 31/5/2001 LT.Version = 1; p = class(LT,'cglookupone',e); return end if ischar(name) if nargin ==1 Norm = cgnormaliser(['Axis_' name]); pE = cgnormfunction( name, zeros(0,2), Norm ); e = pE.info; LT.Version = 1; end else error(message('mbc:cglookupone:InvalidArgument')); end if ~isempty(varargin) % Parse data values data = varargin{1}; if nargin == 2 % create a dummy normaliser Norm = cgnormaliser(['Axis_' name],[data(:,1) [0:size(data,1)-1]']); end if nargin > 2 X= varargin{2}; Norm = cgnormaliser(['Axis_' name],[data(:,1) [0:size(data,1)-1]'], X); end if nargin > 3 v = varargin{3}; Norm = cgnormaliser(['Axis_' name],[data(:,1) [0:size(data,1)-1]'], X, v); else v = []; end % create a cgnormfunction with this normaliser if ~isempty(v) pE = cgnormfunction(name, data(:,2) , Norm, v); else pE = cgnormfunction(name, data(:,2) , Norm); end e = pE.info; LT.Version = 1; end % Create object class and assign xregpointer LT = class(LT,'cglookupone',e); p = xregpointer(LT);