0001 function a=subsasgn(a, s, b)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028 if length(s)==3
0029 switch s(1).type
0030 case '()'
0031 a(s(1).subs{:}).(s(2).subs){s(3).subs{:}}=b;
0032 otherwise
0033 disp(['Error in theta neuron subsasgn: Invalid subscript assignment']);
0034 a = -1;
0035 return;
0036 end
0037 elseif length(s)==2
0038 switch s(1).type
0039 case '()'
0040 a(s(1).subs{:}).(s(2).subs)=b;
0041 case'{}'
0042 a{s(1).subs{:}}.(s(2).subs)=b;
0043 otherwise
0044 disp(['Error in theta neuron subsasgn: Invalid subscript assignment']);
0045 a = -1;
0046 return;
0047 end
0048 elseif length(s)==1
0049 switch s(1).type
0050 case '.'
0051 a.(s(1).subs)=b;
0052 case '()'
0053 a(s(1).subs{:})=b;
0054 case'{}'
0055 a{s(1).subs{:}}=b;
0056 otherwise
0057 disp(['Error in theta neuron subsasgn: Invalid subscript assignment type - ' s(1).type]);
0058 a = -1;
0059 return;
0060 end
0061 end