You are THOROUGHLY CONFUSED!
You do not understand MANY fundamental concepts.
1. [ trainednet, trainingrecord] = train(untrainednet, input, target)
target = desiredoutput
2. output = trainednet(input);
3. error = target - output;
4. input, target, output and error with length N are all divided into 3 INTERMINGLED parts: TRAINING, VALIDATION AND TESTING with number of points Ntrn, Nval and Ntst ,respectively with
5. a. trn used to calculate weights
b. val used to stop training when val error
CONTINUALLY INCREASES FOR A SPECIFIED NUMBER
OF EPOCHS (eg, 5)
c. tst used to obtain an unbiased
(i.e., nondesign) error estimate
Hope this helps.
Thank you for formally accepting my answer