MATLAB: Where is the problem in the neural network script? I cannot update the weights and biases after training.

Deep Learning Toolboxneural network

I am trying to design a custom neural network model to solve a problem. Here is the script:
net= network;
net.numInputs = 1;
net.inputs{1}.size = 1;
net.numLayers = 2;
net.layers{1}.size = 5;
net.layers{2}.size = 1;
net.inputConnect(1,1) = 1;
net.inputConnect(2,1) = 0;
net.biasConnect(1) = 1;
net.biasConnect(2) = 0;
net.layerConnect(2,1) = 1;
net.layers{1}.transferFcn = 'logsig';
net.layers{2}.transferFcn = 'purelin';
net.inputWeights{1,1}.initFcn = 'initzero';
net.inputWeights{1,1}.learn = 1;
net.inputWeights{1,1}.learnFcn = 'learngd';
net.layerWeights{2,1}.initFcn = 'initzero';
net.layerWeights{2,1}.learn = 1;
net.layerWeights{2,1}.learnFcn = 'learngd';
net.biases{1}.initFcn = 'initzero';
net.biases{1}.learn = 1;
net.biases{1}.learnFcn = 'learngd';
net.outputConnect = [0 1];
net.initFcn = 'initlay';
net.trainFcn = 'traingd';
net.performFcn = 'sse';
And here is the the diagram for the neural network:
Before I trained the network, I typed
net.IW{1}; net.b{1}; net.LW{2,1}
in the command window and checked that the values were all initially zero. However, when I trained the network, say
train(net, 0.1, 1)
Even though there was a pop-up window showing the process,
it seemed that the weights and biases did not update as I typed net.IW{1}, net.b{1} and net.LW{2,1}. Also, the output was always zero, no matter what value I input using
sim()
Could anyone help me to indicate the problem in the script or the procedure in training? Thank you.

Best Answer

train(net, 0.1, 1)
You cannot train with a single point. You need input and target row vectors or matrices.