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 if ~strcmp(s(1).type,'.')
0028 disp('Error in theta neuron network subsasgn: Arrays of networks are not currently supported');
0029 end
0030
0031
0032
0033 if strcmp(s(1).type,'.') && strcmp(s(1).subs,'Neurons')
0034
0035 a.(s(1).subs)=subsasgn(a.(s(1).subs), s(2:end), b);
0036 return;
0037 end
0038
0039 if max(strcmp(s(1).subs,{'SimulationMethod', 'TimeStep', 'ReferenceTime'}))
0040 err1 = strcmp(s(1).subs,'SimulationMethod') && (~ischar(b) || (~strcmp(b,'Event-Driven') && ~strcmp(b,'Numeric')));
0041 err2 = strcmp(s(1).subs,'TimeStep') && ~isnumeric(b);
0042 err3 = strcmp(s(1).subs,'ReferenceTime') && (~isnumeric(b) || b<0);
0043 if err1 || err2 || err3
0044 disp(['Error in theta neuron network subsasgn: Invalid values for assignment to ' s(1).subs]);
0045 a=-1;
0046 return;
0047 end
0048 a.(s(1).subs)=b;
0049 elseif max(strcmp(s(1).subs,{'Weights', 'Delays'}))
0050 if length(s)==1 && strcmp(s(1).type,'.')
0051 a.(s(1).subs)=b;
0052 else
0053 switch s(2).type
0054 case '()'
0055 err1 = max(strcmp(s(1).subs,{'Weights','Delays'})) && ~isnumeric(b);
0056 if err1
0057 disp(['Error: Invalid values for assignment to ' s(1).subs]);
0058 return;
0059 end
0060 disp('Here');
0061 a
0062 a.(s(1).subs)
0063 a.(s(1).subs)(s(2).subs{:})
0064 a.(s(1).subs)(s(2).subs{:})=b;
0065 case '{}'
0066 disp('Error: Theta Neuron Networks do not have any cell fields');
0067 case '.'
0068 otherwise
0069 disp(['Error in theta neuron network subsasgn: Invalid subscript assignment']);
0070 a = -1;
0071 end
0072 end
0073 elseif max(strcmp(s(1).subs,{'InputNeurons', 'OutputNeurons', 'RecursionFlag','NeuronQueue','RelativeInputNeurons','RelativeOutputNeurons'}))
0074 disp(['Warning: ', s(1).subs ' is computed automatically when the network is created.']);
0075 disp([' Call update_structure to update these values.']);
0076 else
0077 disp(['Error: ' s(1).subs ' is an invalid theta neuron network field']);
0078 a=-1;
0079 return;
0080 end