MATLAB: Error Message when using configured ANN (mismatch number of inputs)

annDeep Learning Toolboxnarxneural network

After creating and storing an ANN in Matlab (ANN Toolbox V 7.0) I tried to compute new predictions using a new set of input observations with:
net(new_obs)
the old Input Matrix was 1511×145, the new one is 100×145, observations are in rows each time. But the error message I get is now:
??? Error using ==> network.sim at 121
Number of inputs does not match net.numInputs.
Error in ==> network.subsref at 14
[v,out2,out3] = sim(vin,subs{:});
In fact, the origin Input matrix does not work with this code either!
I'm wondering if this error corresponds to the type of ANN I'm using since this one is a NARX. But I created a different ANN for a completely different purpose (Pattern Recognition with binary outcome) and there it works at a glance. :-/
Help is greatly appreciated!

Best Answer

The functions for creating networks in the toolbox will assume that if your input matrix is n x m it will represent m samples of n elements each.
You should present your data to the network as a transposed matrix 145x1511 of your current input matrix when you train the network. The same when you present new inputs to the network, 145x100.
Update
In order to present your input to the network, you can use tonndata in convert your matrix to the standard cell array form. After doing that, the output from tonndata which will be the input to your network, should look like:
[145x1 double] [145x1 double] ... [145x1 double]
1511 times
You should do the same for your targets. Then you can use preparets and train to complete the training process. Once that is done, you should be able to simulate the network, convert to closeloop in order to perform a multi-step-ahead prediction, etc. Notice that you will have to use tonndata again to present new inputs for the simulation process.