Home > atmlab > handy > alias.m

alias

PURPOSE ^

alias Define and use aliases

SYNOPSIS ^

function A = alias(varargin)

DESCRIPTION ^

 alias Define and use aliases

 Define and use aliases.

 FORMAT

   A = alias % get struct with all defined aliases

       or

   A = alias(foo) % get alias

       or

   A = alias(foo, bar) % set alias

 IN

   name    string
   value   (optional)

 OUT

   A

 $Id: alias.m 6543 2010-10-07 15:57:41Z gerrit $

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

alias.m

SOURCE CODE ^

0001 function A = alias(varargin)
0002 
0003 % alias Define and use aliases
0004 %
0005 % Define and use aliases.
0006 %
0007 % FORMAT
0008 %
0009 %   A = alias % get struct with all defined aliases
0010 %
0011 %       or
0012 %
0013 %   A = alias(foo) % get alias
0014 %
0015 %       or
0016 %
0017 %   A = alias(foo, bar) % set alias
0018 %
0019 % IN
0020 %
0021 %   name    string
0022 %   value   (optional)
0023 %
0024 % OUT
0025 %
0026 %   A
0027 %
0028 % $Id: alias.m 6543 2010-10-07 15:57:41Z gerrit $
0029 
0030 
0031 persistent S
0032 
0033 if ~isstruct(S)
0034     S = struct;
0035 end
0036 
0037 switch nargin
0038     case 0
0039         A = S;
0040     case 1
0041         A = S.(varargin{1});
0042     case 2
0043         S.(varargin{1}) = varargin{2};
0044     otherwise
0045         error('atmlab:alias', 'incorrect number of arguments: %d', ...
0046             nargin);
0047 end

Generated on Mon 15-Sep-2014 13:31:28 by m2html © 2005