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

    function [Lines, Bold, Indent] = str_view(m, Name, Pooled_RMSE)
%STR_VIEW Create strings for displaying full model description
%
%  [LINES, BOLD, INDENT] = STR_VIEW(M) returns information that is used for
%  displaying the model description.  LINES is a cell array containing
%  separate lines of text.  BOLD and INDENT are logical arrays the same
%  size as LINES that indicate whether a line should be bold or indented.
%
%  [...] = STR_VIEW(M, NAME) creates a model description that references
%  the model by the specified name instead of the default output variable
%  name.
%
%  [...] = STR_VIEW(M, NAME, RMSE) passes in the pooled RMSE value for
%  display.
%
%  This method is called by the modelpane object to provide display
%  information.  It is expected that LINES may contain tex expressions.

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


yi = yinfo(m);
if nargin<2 || isempty(Name)
    Name = yi.Name;
end
if nargin<3
    Pooled_RMSE = 1;
end
Name = detex(Name);

Expr = str_code(m,1);
fX = str_func(m,1);
ytrans = str_yinv(m,1);

% display fitted equation
eqn = char(m);
yvar = detex(yi.Name);
if size(eqn,1)>1
	eqn = [char([yvar,' = '],repmat(' ',size(eqn,1)-1,length(yi.Name)+3)) eqn];
else
	eqn = [yvar,' = ',eqn];
end      

% should also display covariance model
cov = char(covmodel(m),1,Pooled_RMSE^2);

str = {eqn,cov};
if DatumType(m)
   str = [str, {sprintf('Datum= %.4g',datum(m))}];
end

chModel = cellstr(char(str));

Lines=[{['Local Model for ', Name]};...         % Description
      {'Coding'};...    
      Expr(:);...     % Coding
      {fX};...        % Function Description
      chModel];     % Equation display

Bold = [true; ...
    true; ...
    false(length(Expr),1); ...
    true; ...
    false(length(chModel),1)];
Indent = ~Bold;

if ~isempty(ytrans);
    Lines = [Lines;...
        {'Y Transformation';...
        [detex(yi.Name),' = ',ytrans]}];
    Bold = [Bold; true; false];
    Indent = [Indent; false; true];
end