www.gusucode.com > mbc 工具箱 matlab 源码程序 > mbc/@mbcmodel/@localresponse/pSetModel.m

    function val = pSetModel(R, val)
%PSETMODEL private function
%
% mdev = pSetModel(R,L)

%  Copyright 2007 The MathWorks, Inc.

M = val;
mdev = R.Object;
mod = M.Object;

% Is the model going back in the same place? This is a limitation that
% should be removed when we can asscertain if the model is of the correct
% type to site here. Generally this should be a check that the number of
% factors and model class are suitable for this node
if isempty(M.Response) || (R ~= M.Response)
    error('mbc:mbcmodel:response:InvalidState', ...
        'A model can only be replaced on the same node of a project as it originated.');
end

% change model for underlying local model
mdev = pSetModel(mdev,mod);

R.pInitialise(address(mdev));

val = [];