Home > TNNT_1_07 > @theta_neuron > display.m

display

PURPOSE ^

DISPLAY displays a theta neuron object (or an array of theta neuron objects)

SYNOPSIS ^

function display(Thn)

DESCRIPTION ^

DISPLAY displays a theta neuron object (or an array of theta neuron objects)

Description:
This function is called anytime a theta neuron object is referenced
without a terminating semi-colon. Theta neuron fields are displayed
in a readable manner. In the case of an array, for fields that vary
within the array, "Varies" is displayed.

Syntax:
DISPLAY(Thn);

Input Parameters:
o Thn: A single theta neuron or array of theta neurons.

Output Parameters:
o None

Examples:
>> N1=theta_neuron

>> N2=theta_neuron('Size', [3]);
>> N2(1).Alpha=2;
>> N2

See also theta_neuron

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function display(Thn)
0002 %DISPLAY displays a theta neuron object (or an array of theta neuron objects)
0003 %
0004 %Description:
0005 %This function is called anytime a theta neuron object is referenced
0006 %without a terminating semi-colon. Theta neuron fields are displayed
0007 %in a readable manner. In the case of an array, for fields that vary
0008 %within the array, "Varies" is displayed.
0009 %
0010 %Syntax:
0011 %DISPLAY(Thn);
0012 %
0013 %Input Parameters:
0014 %o Thn: A single theta neuron or array of theta neurons.
0015 %
0016 %Output Parameters:
0017 %o None
0018 %
0019 %Examples:
0020 %>> N1=theta_neuron
0021 %
0022 %>> N2=theta_neuron('Size', [3]);
0023 %>> N2(1).Alpha=2;
0024 %>> N2
0025 %
0026 %See also theta_neuron
0027 
0028 %Copyright (C) 2008 Sam McKennoch <Samuel.McKennoch@loria.fr>
0029 
0030 
0031 f=fields(Thn);
0032 ProtoFlag=0;
0033 NumNeuron=0;
0034 
0035 %Determine which fields vary in a neuron array
0036 for ij=1:prod(size(Thn))
0037     if isempty(Thn(ij).(f{1}))
0038         continue;
0039     end
0040     NumNeuron=NumNeuron+1;
0041     if ProtoFlag==0
0042         ThnTemp=Thn(ij);
0043         ThnFinal=Thn(ij);
0044         ProtoFlag=1;
0045     end
0046     for j=1:length(f)
0047         if ~iscell(Thn(ij).(f{j}))
0048             if Thn(ij).(f{j})~=ThnTemp.(f{j})
0049                 ThnFinal.(f{j})='Varies';
0050             end
0051         else
0052             for ik=1:length(Thn(ij).(f{j}))
0053 
0054                 if ischar(Thn(ij).(f{j}){ik}) && ~strcmp(Thn(ij).(f{j}){ik},ThnTemp.(f{j}){ik})
0055                     ThnFinal.(f{j}){ik}='Varies';
0056                 elseif Thn(ij).(f{j}){ik}~=ThnTemp.(f{j}){ik}
0057                     ThnFinal.(f{j}){ik}='Varies';
0058                 end
0059             end
0060         end
0061     end
0062 end
0063 
0064 
0065 if exist('ThnFinal')
0066     %Display the fields
0067     disp(' ');
0068     disp('The Following Aggregate Fields are Defined for the Neuron Array');
0069     disp(['   of size [', num2str(size(Thn)), '] with ' num2str(NumNeuron) ' Non-Empty Neuron(s):']);
0070     disp(' ');
0071     Thn=ThnFinal;
0072     for j=1:length(f)
0073         if isempty(Thn.(f{j}))
0074             disp(['   ', f{j}, ' is empty']);
0075             continue;
0076         end
0077         if strcmp(f{j},'InitialPhaseMethod')
0078             if isempty(Thn.(f{j}){1})
0079                 disp(['   ', f{j}, ' is empty']);
0080                 continue;
0081             end
0082             if length(Thn.(f{j}))==1
0083                 disp(['   ', f{j}, ' = ' Thn.(f{j}){1}]);                
0084             else
0085                 disp(['   ', f{j}, ' = ' Thn.(f{j}){1} ' of ' num2str(Thn.(f{j}){2})]);                
0086             end
0087         else
0088             if ischar(Thn.(f{j}))
0089                 disp(['   ', f{j}, ' = ' Thn.(f{j})]);
0090             elseif isnumeric(Thn.(f{j}))
0091                 disp(['   ', f{j}, ' = ' num2str(Thn.(f{j}))]);
0092             end
0093         end
0094     end
0095     disp(' ');
0096 else
0097     %Display for the case where all neurons are empty
0098     disp(' ');
0099     if prod(size(Thn))==1
0100         disp('The neuron is empty');
0101     else
0102         disp(['The neuron array of size [' num2str(size(Thn)), '] is empty']);
0103     end
0104     disp(' ');
0105 end

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