Prev: Engineering
Next: Engineering
From: Ajith on 14 Jun 2010 08:15 classdef Dendrite properties d_weight; d_points_to; end methods(Static) function obj = Dendrite(weight,points_to) if nargin>0 obj.d_weight=weight; obj.d_points_to=points_to; end end end end ............................................................ classdef Neuron properties n_ID; n_value; n_bias; n_delta; Dentrites=Dendrite.empty(5,0); %array of class Dentrites; end methods (Static) function obj = Neuron(ID,value,bias) if nargin>0 obj.n_ID=ID; obj.n_value=value; obj.n_bias=bias; obj.n_delta=0.0; end end function SetDendrites(obj,dendrite) if nargin>0 obj.Dentrites=Dendrite.empty(dendrite,0); for i=1:dendrite obj.Dendrites(i).d_points_to=i; end end end end end ................................................................................ classdef Layer properties Neurons=Neuron.empty(5,0); end methods(Static) function obj=Initialize(size) if nargin>0 obj.Neurons=Neuron.empty(size,0); end end function N=GetNeuron(obj,index) N=obj.Neurons(index); end function SetNeuron(obj,neuron,index) if nargin>0 obj.Neurons(index)=neuron; end end end end ......................................................................... obj.Layers(i).Neurons(j).Dendrites(k).d_weight=rand(1,1)/11; when I try to access property like this it gives following error....... ??? No appropriate method, property, or field Dendrites for class Neuron. Error in ==> Network>Network.RandomizeWB at 51 obj.Layers(i).Neurons(j).Dendrites(k).d_weight=rand(1,1)/11; How should i correct this error...please help me.... and I also want to know how should i create array of classs in dynamically Thanks
From: Steven Lord on 14 Jun 2010 09:27 "Ajith " <aindike(a)gmail.com> wrote in message news:hv56h6$5cj$1(a)fred.mathworks.com... *snip* > ........................................................... > classdef Neuron properties > n_ID; n_value; n_bias; n_delta; Dentrites=Dendrite.empty(5,0); > %array of class Dentrites; Reread this line carefully -- character by character, in fact. You have two typos in this line; one is the cause of the error, and the other is harmless but I'd fix it for correctness. *snip* > obj.Layers(i).Neurons(j).Dendrites(k).d_weight=rand(1,1)/11; > when I try to access property like this it gives following error....... > ??? No appropriate method, property, or field Dendrites for class > Neuron. As your code is written, the error message is correct. > Error in ==> Network>Network.RandomizeWB at 51 > > obj.Layers(i).Neurons(j).Dendrites(k).d_weight=rand(1,1)/11; > > How should i correct this error...please help me.... > and I also want to know how should i create array of classs in dynamically I don't understand this part of the question. If you want to create an array of class objects, perhaps REPMAT will meet your needs? -- Steve Lord slord(a)mathworks.com comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ To contact Technical Support use the Contact Us link on http://www.mathworks.com
From: Ajith on 14 Jun 2010 23:02 I can not understand the error of this line classdef Neuron properties > n_ID; n_value; n_bias; n_delta; Dentrites=Dendrite.empty(5,0); please can u correct it . thank u for ur kindness
From: Ajith on 15 Jun 2010 03:33 I have found the error > thank u for ur kindness
|
Pages: 1 Prev: Engineering Next: Engineering |