Home > classes > @history > subsref.m

subsref

PURPOSE ^

SUBSREF Define field name indexing for history objects.

SYNOPSIS ^

function B = subsref(A, S)

DESCRIPTION ^

 SUBSREF Define field name indexing for history objects.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

 DESCRIPTION: SUBSREF Define field name indexing for history objects.

 EXAMPLES:    All possible accesses are possible.

 VERSION:     $Id: subsref.m,v 1.2 2007/08/01 13:55:52 ingo Exp $

 HISTORY:     31-01-07 M Hewitson
                 Creation

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function B = subsref(A, S)
0002 % SUBSREF Define field name indexing for history objects.
0003 %
0004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0005 %
0006 % DESCRIPTION: SUBSREF Define field name indexing for history objects.
0007 %
0008 % EXAMPLES:    All possible accesses are possible.
0009 %
0010 % VERSION:     $Id: subsref.m,v 1.2 2007/08/01 13:55:52 ingo Exp $
0011 %
0012 % HISTORY:     31-01-07 M Hewitson
0013 %                 Creation
0014 %
0015 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0016 B = builtin('subsref', A, S);
0017 
0018 % function varargout = subsref(h, index)
0019 % % SUBSREF Define field name indexing for history objects.
0020 % %
0021 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0022 % %
0023 % % DESCRIPTION: SUBSREF Define field name indexing for history objects.
0024 % %
0025 % % EXAMPLES:
0026 % %
0027 % %  nesting level == 1
0028 % %
0029 % %    >>  h1      = h(1);
0030 % %    >>  name    = h.name;
0031 % %    >>  version = h.version;
0032 % %    >>  plist   = h.plist;
0033 % %    >>  inhist  = h.inhist;
0034 % %    >>  invars  = h.invars;
0035 % %    >>  n       = h.n;
0036 % %    >>  pn      = h.pn;
0037 % %    >>  created = h.created;
0038 % %    >>  consver = h.consver;
0039 % %
0040 % % VERSION: $Id: subsref.m,v 1.2 2007/08/01 13:55:52 ingo Exp $
0041 % %
0042 % % HISTORY: 06-06-07 Diepholz
0043 % %             Creation
0044 % %
0045 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0046 %
0047 % switch length(index)
0048 %   case 1
0049 %     switch index.type
0050 %
0051 %       % INFO: h1 = h(2)
0052 %       %            h(1)
0053 %       case '()'
0054 %         if length (index.subs) == 1
0055 %
0056 %           % assure that the number of outputs matches
0057 %           if nargout == 0
0058 %             plot(h(index.subs{1}))
0059 %           elseif nargout == 1
0060 %             varargout{1} = h(index.subs{1});
0061 %           else
0062 %             error('### the number of outputs does not match. Please use two outputs.')
0063 %           end
0064 %
0065 %         % INFO: h(2,1) not possible
0066 %         else % length (index.subs) == 2
0067 %           error ('### Do not use two indices.');
0068 %         end
0069 %
0070 %       % INFO: name    = h.name;
0071 %       %       version = h.version;
0072 %       %       plist   = h.plist;
0073 %       %           ...
0074 %       case '.'
0075 %         fieldName = index.subs;
0076 %         eval(sprintf('varargout{1} = h.%s;', fieldName));
0077 %
0078 %       otherwise
0079 %         error('### only ''.'' and ''()'' indexing methods for history objects are allowed.');
0080 %     end
0081 %   otherwise
0082 %     error('### nesting level for history objects is too large.');
0083 % end
0084 %
0085 % % END
0086 %

Generated on Mon 03-Sep-2007 12:12:34 by m2html © 2003