www.gusucode.com > mbcmodels 工具箱 matlab 源码程序 > mbcmodels/@xregtwostage/InitStore.m

    function TS=InitStore(TS,Xcode,Yrf,Ydatum)
%INITSTORE

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



DatumType= get(TS.Local,'DatumType');
if DatumType
   TS.datum= iInitStore(TS.datum,Xcode,Ydatum);
end

for i=1:length(TS.Global);
   TS.Global{i}= iInitStore(TS.Global{i},Xcode,Yrf(:,i));
end



function m= iInitStore(m,X,Yrf)

if islinear(m)
    % This is only needed for press predictions 
    X= double(X);
    Yrf= double(Yrf);
    % Need coded and transformed data
    [Xcode,Ytrans,DataOK]= checkdata(m,X,Yrf);
    % Need to set unused data to NaN so that press predictions will be
    % aligned with data
    Yrf(~DataOK)= NaN;
    X(DataOK,:)= Xcode;
    % Initstore without variance calculation
    m= InitStore(m,X,Yrf,~DataOK,false);
end