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

    function labs = GetTermLabel(m, t, varargin)
%GETTERMLABEL Get a human-readable label for one or more specified terms.
%   The specified terms form a row where each value gives the power of that
%   parameter.
%
%   L = GETTERMLABEL( P )
%   L = GETTERMLABEL( P, TERM )
%   L = GETTERMLABEL( P, TERM, ARGS )
%
%   For example, if a model has four inputs, P,Q,R,S and the order is set
%   to [2 2 2 2], then
%      P.GetTermLabel([0 0 1 2;1 0 1 0] )
%   produces
%      {'R*S^2'; 'P*R'}
%   and
%      P.GetTermLabel( [0 0 1 2;1 0 1 0], 'Format', 'Formula' )
%   produces
%      'R*S^2 + P*R'

%   Copyright 2006 The MathWorks, Inc.



labs = labels(m,0);
if nargin>1 
    if iscellstr(t)
        [OK,loc] = ismember(t,labs);
        if ~all(OK)
            error(message('mbc:xreglinear:GetTermLabel:InvalidValue'));
        end
        labs = labs(loc);
    end
end