Home > TNNT_1_07 > @theta_neuron_network > subsasgn.m

subsasgn

PURPOSE ^

SUBSASGN allows theta neuron object fields to be subscript assigned

SYNOPSIS ^

function a=subsasgn(a, s, b)

DESCRIPTION ^

SUBSASGN allows theta neuron object fields to be subscript assigned

Description:
This function is called anytime a theta neuron object field is 
subscript assigned use the subscript types '.','()' or '{}'

Syntax:
N/A

Input Parameters:
o N/A

Output Parameters:
o N/A

Examples:
>> ThNN=theta_neuron_network;
>> ThNN.Neurons(2).InitialPhaseMethod{2}=1e-3;
>> ThNN.Neurons

See also theta_neuron_network

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function a=subsasgn(a, s, b)
0002 %SUBSASGN allows theta neuron object fields to be subscript assigned
0003 %
0004 %Description:
0005 %This function is called anytime a theta neuron object field is
0006 %subscript assigned use the subscript types '.','()' or '{}'
0007 %
0008 %Syntax:
0009 %N/A
0010 %
0011 %Input Parameters:
0012 %o N/A
0013 %
0014 %Output Parameters:
0015 %o N/A
0016 %
0017 %Examples:
0018 %>> ThNN=theta_neuron_network;
0019 %>> ThNN.Neurons(2).InitialPhaseMethod{2}=1e-3;
0020 %>> ThNN.Neurons
0021 %
0022 %See also theta_neuron_network
0023 
0024 %Copyright (C) 2008 Sam McKennoch <Samuel.McKennoch@loria.fr>
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 %Pass to the neuron class assignment function
0033 if strcmp(s(1).type,'.') && strcmp(s(1).subs,'Neurons')
0034     %Automatically calls the theta_neuron subsasgn
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'})) %For assigning scalar fields
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,'.') %Complete Assignment
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; %For Assigning Weights or Delays
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

Generated on Wed 02-Apr-2008 15:16:32 by m2html © 2003