www.gusucode.com > mbcdata 工具箱 matlab 源码程序 > mbcdata/@cgfuncmodel/EvalModel.m
function out = EvalModel(f,X) %EVALMODEL Evaluate the model % % OUT = EVALMODEL(F,X) evaluates a function model object, F. This code is % vectorised and expects an nxm matrix where n is the number of data % points and m is the number of factors. % % Input ordering can be found by argnames(F). % Copyright 2000-2005 The MathWorks, Inc. and Ford Global Technologies, Inc. if ~iscell(X) data = cell(1, size(X,2)); for i=1:size(X,2) data{i} = X(:,i); end X = data; elseif ~isempty(X) % Check that all cells have same length inputs L = cellfun('prodofsize', X); if ~all(L==L(1)) maxL = max(L); for n = 1:length(L) if L(n)~=maxL && L(n)==1 X{n} = repmat(X{n}, maxL, 1); end end end end try out = f.funcv(X{:}); catch out = NaN(size(X{1},1), 1); end if ~isa(out,'double') out = double(out); end