Hi,
The error occured because you created a network with 7 separate input ports (predictionNet.numInputs = 7;). With seven input ports MATLAB expects 7 × Q cells (Q samples). A single column looked like “one time-step” rather than “Q samples”. So instead of this you can collapse it to one input port and tell the net that it has one input of size 7.
Additonally instead of the manual work, you can use the straightforward pattern-recognition net that handles all the bookkeeping automatically.
patternnet internally creates correct inputConnect, layerConnect, biases, transfer functions, and data splits. patternnet trains a soft-max output and needs targets sized nClasses × Q.
Below is an example to implement it:
temp = 20 + 10*rand(1,Q);
humid = 40 + 20*rand(1,Q);
SLP = 1005 + 10*rand(1,Q);
precip = max(0, randn(1,Q));
SWR = 200 + 50*randn(1,Q);
wind = 3 + 2*randn(1,Q);
dir = 360*rand(1,Q);
labels = randi(3,1,Q);
X = [temp; humid; SLP; precip; SWR; wind; dir];
T = ind2vec(labels(:)');
hiddenSizes = [10 20 20 15];
net = patternnet(hiddenSizes,'trainlm');
net = configure(net, X, T);
[net,tr] = train(net, X, T);
Y = net(X);
predCls = vec2ind(Y);
accTrain = mean(predCls == labels)*100;
Here is more information on "patternnet":
Hope this helps!