MATLAB: Adaptwb failed to calculate gradient of biases, input weights, and layer weights

adaptadaptwbincremental training

Hello,
Currently I am using Matlab R2010b Neural Network Toolbox.
I am trying to train elman network for binary time series prediction. Specifically I would like to do incremental training (adapt) technique by means of function adaptwb. My input is binary sequences in cell arrays format, and I expect the elman net can predict one step ahead binary output.
However, it always failed to calculate the gradient of bias, input weights, and layer weights as follows:
>> P = [0 0 0 0 0 1 1 1 1]; T = [P(2:end) P(1)];
>> P = con2seq(P); % input seq
>> T = con2seq(T); % output seq - 1 ts lead version of input seq
>> net = layrecnet(1:1, 10);% elman net 1 lyr delay, 10 hdn nodes
>> [Ps, Pi, Ai, Ts] = preparets(net, P, T);
>> [net, Y, E, Pf, Af] = adapt(net, Ps, Ts, Pi, Ai);
??? Index exceeds matrix dimensions.
Error in ==> C:\Program
Files\MATLAB\R2010b\toolbox\nnet\nnutils\+nnprop\grad.p>grad at 187
Error in ==> adaptwb>adapt_network at 96
[gB,gIW,gLW] =
nnprop.grad(net,Q,PD(:,:,ts),BZ,IWZ,LWZ,N,Ac(:,ts+AcInd),gE,1,TS,fcns);
Error in ==> adaptwb at 39
[out1,out2,out3] = adapt_network(in1,in2,in3,in4);
Error in ==> network.adapt at 122
[net,Ac,tr] = feval(adaptFcn,net,Pd,T,Ai);
>>
Could you please tell me what is the correct procedure to do such incremental training? Thank you for your help.

Best Answer

The input example does not appear to have any prediction capability. Why not use the example in the newelm documentation?
P = round(rand(1,N));
T = [0 (P(1:end-1)+P(2:end) == 2)];
I am not sure if adapt is the appropriate training function. What happens if you use train?