www.gusucode.com > mbcexpr 工具箱 matlab 源码程序 > mbcexpr/@cgsubexpr/private/pEval.m

    function out = pEval(obj, inputs)
%PEVAL Private evaluation helper
%
%  OUT = PEVAL(OBJ, INPUTS) evaluates the switch expression at inputs
%  that are provided by the cell array INPUTS.  

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


NLeft = obj.NLeft;
if NLeft
    out = inputs{1};
    for n = 2:NLeft
        out = out + inputs{n};
    end
else
    out = 0;
end
if obj.NRight
    for n = (NLeft+1):(NLeft+obj.NRight)
        out = out - inputs{n};
    end
end