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

    function m=loadobj(m);
% XREGMODEL/LOADOBJ load object maintenance 

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



if isa(m,'struct')
	m= xregmodel(m);
end	
if ~isfield(m.Stats,'Summary')
    m.Stats.Summary=[];
end

% version 5 changed the units from char to junit
if m.version<5
	% this should be the latest version number
	m.version= 6;
	
	if isempty(m.Xinfo.Units)
		m.Xinfo.Units= cell(1,nfactors(m));
	end
	
	% update units on inputs and outputs
	for i= 1:length(m.Xinfo.Units);
        uc= m.Xinfo.Units{i};
        if ~(ischar(uc) && ~strcmp(uc,'?'))
            m.Xinfo.Units{i}= '';
        end
	end
	yu= m.Yinfo.Units;
	if ~(ischar(yu) && ~strcmp(yu,'?'))
		m.Yinfo.Units= '';
	end
	% old update 
	for i= 1:length(m.code);
		g= char(m.code(i).g);
		if strcmp(g,'x')
			m.code(i).g='';
		end
	end
	
end