Index in position 2 exceeds array bounds (must not exceed 1).
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I am getting the following error with my code. I am making a neural network using narxnet and this error is coming in the preparenets function.
Index in position 2 exceeds array bounds (must not exceed 1).
Error in preparets (line 317)
xi = xx(:,FBS+((1-net.numInputDelays):0));
Error in narx (line 6)
[Xs,Xi,Ai,Ts] = preparets(net,x,{},y);
Here is my code:
data = xlsread('data230k1.xlsx');
x = data(1:81000,2)';
y = data(1:81000,1)';
net = narxnet(1:2,1:2,50);
[Xs,Xi,Ai,Ts] = preparets(net,x,{},y);
[net,tr] = train(net,Xs,Ts,Xi,Ai);
nntraintool;
Y = net(Xs,Xi,Ai);
E = gsubtract(Ts,Y);
Can someone help??
0 Kommentare
Antworten (1)
Raunak Gupta
am 22 Jun. 2020
Hi,
The above error is due to the input data x and y not being in the standard cell array format to be inputted to the narxnet. You can use tonndata for converting the vector x and y to cell array. For above code following changes to x and y will help:
data = xlsread('data230k1.xlsx');
x = data(1:81000,2)';
y = data(1:81000,1)';
xCell = tonndata(x,true,false);
yCell = tonndata(y,true,false);
net = narxnet(1:2,1:2,50);
[Xs,Xi,Ai,Ts] = preparets(net,xCell,{},yCell);
[net,tr] = train(net,Xs,Ts,Xi,Ai);
nntraintool;
Y = net(Xs,Xi,Ai);
E = gsubtract(Ts,Y);
Siehe auch
Kategorien
Mehr zu Sequence and Numeric Feature Data Workflows finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!