www.gusucode.com > mbcdesign 工具箱 matlab 源码程序 > mbcdesign/@coninputfactor/xyzlabel.m

    function xyzlabel(cif, hAxis)
%XYZLABEL Label the axis of a plot
%
%  XYZLABEL(CIF, HAXIS)
%  XYZLABEL(CIF) uses HAXIS = GCA.
%
%  Example
%     xyzlabel( cif([1,3,4]) );
%
%  See also CONINPUTFACTOR, XLABEL, YLABEL, ZLABEL.

%  Copyright 2005-2011 The MathWorks, Inc.

if length( cif ) ~= 3,
    error(message('mbc:coninputfactor:InvalidInput'));
end
if nargin < 2,
    hAxis = gca;
end

set( get( hAxis, 'XLabel' ), 'String', toString( iFactor( cif, 1 ) ) );
set( get( hAxis, 'YLabel' ), 'String', toString( iFactor( cif, 2 ) ) );
set( get( hAxis, 'ZLabel' ), 'String', toString( iFactor( cif, 3 ) ) );

%------------------------------------------------------------------------------|
function cif = iFactor( cif, i )
cif = subsref( cif, struct( 'type', '()', 'subs', {{i}} ) );

%------------------------------------------------------------------------------|
% EOF
%------------------------------------------------------------------------------|