Home > classes > @param > subsasgn.m

subsasgn

PURPOSE ^

SUBSASGN define index assignment for parameter properties.

SYNOPSIS ^

function A = subsasgn(A, S, B)

DESCRIPTION ^

 SUBSASGN define index assignment for parameter properties.

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

 DESCRIPTION: SUBSASGN define index assignment for parameter properties.

 EXAMPLES:    All possible assignment are possible.

 VERSION:     $Id: subsasgn.m,v 1.2 2007/08/13 13:19:17 ingo Exp $

 HISTORY:     31-01-07 M Hewitson
                 Creation

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

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function A = subsasgn(A, S, B)
0002 % SUBSASGN define index assignment for parameter properties.
0003 %
0004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0005 %
0006 % DESCRIPTION: SUBSASGN define index assignment for parameter properties.
0007 %
0008 % EXAMPLES:    All possible assignment are possible.
0009 %
0010 % VERSION:     $Id: subsasgn.m,v 1.2 2007/08/13 13:19:17 ingo Exp $
0011 %
0012 % HISTORY:     31-01-07 M Hewitson
0013 %                 Creation
0014 %
0015 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0016 A = builtin ('subsasgn', A, S, B);
0017 
0018 
0019 % function ts = subsasgn(ts, index, val)
0020 %
0021 % % SUBSASGN define index assignment for vectors in tsdata.
0022 % %
0023 % % M Hewitson 30-01-07
0024 % %
0025 % % $Id: subsasgn.m,v 1.2 2007/08/13 13:19:17 ingo Exp $
0026 % %
0027 %
0028 % if size(val,2) > size(val,1)
0029 %   val = val.';
0030 % end
0031 %
0032 % switch length(index)
0033 %   case 1   % ts(idx) = [] or ts.t = [] or ts.x = []
0034 %     switch index.type
0035 %       case '()'
0036 %         idx = index.subs{1};
0037 %         if length(val) ~= length(idx)
0038 %           error('### number of values does not match number of indices.');
0039 %         end
0040 %         ts.t(idx) = val(1,:);
0041 %         ts.x(idx) = val(2,:);
0042 %       case '.'
0043 %         switch index.subs
0044 %           case 't'
0045 %             ts.t = val;
0046 %             if length(val) ~= length(ts.x)
0047 %               warning('!!! Time vector no consistent with x vector');
0048 %             end
0049 %           case 'x'
0050 %             ts.x = val;
0051 %             if length(val) ~= length(ts.t)
0052 %               warning('!!! x vector no consistent with time vector');
0053 %             end
0054 %           otherwise
0055 %             error('### unknown field for indexing.');
0056 %         end
0057 %       otherwise
0058 %         error('### unknown indexing method for tsdata objects.');
0059 %     end
0060 %   case 2 % ts.t(idx) = [] or ts.x(idx) = []
0061 %
0062 %     if index(1).type == '.'
0063 %       % first index gets us field name
0064 %       fieldName = index(1).subs;
0065 %       % second index gets us indices
0066 %       idx = index(2).subs{1};
0067 %       switch fieldName
0068 %         case 't'
0069 %           ts.t(idx) = val;
0070 %         case 'x'
0071 %           ts.x(idx) = val;
0072 %         otherwise
0073 %           error('### unknown field to index 1.');
0074 %         end
0075 %     else
0076 %       error('### unknown indexing method for tsdata objects.');
0077 %     end
0078 %
0079 %   otherwise
0080 %     error('### unknown indexing method for tsdata objects.');
0081 % end
0082 %
0083 % END

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