Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Subscript indices must either be real positive integers or logicals.? Error using ==> network.subsref at 83?

Asked by Devarshi Rai on 31 Aug 2013
net=network(8,2,[1;1],[1 1 1 1 1 1 1 1;0 0 0 0 0 0 0 0],[0 0;1 0],[0 1]);
net.initFcn='initlay';
net.layers{1}.transferFcn='logsig';
net.layers{2}.transferFcn='logsig';
net.trainFcn='traingd';
net.trainparam.min_grad=0.001;
net.trainparam.epochs=1000;
net.trainparam.lr=0.3;
net.trainparam.goal=0.01;
net.inputWeights{1,:}.initFcn='rands';
net.layers{1}.initFcn='initwb';
net.layers{2}.initFcn='initwb';
net.layerWeights{2,1}.initFcn='rands';
net.biases{1,1}.initFcn='rands';
net.biases{2,1}.initFcn='rands';
i=load('input.txt');
t=load('target.txt');
i=i';
t=t';
in=zeros(8,53); %normalized input
tn=zeros(1,53); %normalized target
for r=1:8       %normalization of input
min=i(r,1);
max=i(r,1);
for c=2:53
if i(r,c)<min
min=i(r,c);
end
if i(r,c)>max
max=i(r,c);
end
end
for c=1:53
in(r,c)=0.1+(0.8*(i(r,c)-min)/(max-min));
end
end
min=t(1);       %normalization of target
max=t(1);
for c=2:53
if t(1,c)<min
min=t(1,c);
end
if t(1,c)>max
max=t(1,c);
end
end
for c=1:53
tn(1,c)=0.1+(0.8*(t(1,c)-min)/(max-min));
end
initwb(net,i);
net.performFcn = 'sse';
net = train(net,in,tn);
y=net(in)

3 Comments

Walter Roberson on 31 Aug 2013

Do we get a hint as to which line of your code the problem is occurring at?

Devarshi Rai on 31 Aug 2013

after the last line

Devarshi Rai on 31 Aug 2013

I am quite hopeless regarding this problem!!

Devarshi Rai

Products

No products are associated with this question.

0 Answers

Contact us