MATLAB: Usage problem of saved neural network

Deep Learning Toolboxneural network

I have used nnstart to predict future values of my time-series data, what is succeded, and I saved the network to .m file, what I can't use for further use for similar data. The automatically generated script works if the final line is outputs = train(net,inputs,targets,inputStates,layerStates); but is not working with the saved net instead of train, even not with the data the saved network trained with. So I tried just simply to replace the
outputs = train(net,inputs,targets,inputStates,layerStates);
to
load('mynet', 'net');
outputs = net(inputs,inputStates,layerStates);
or even
outputs = net(inputs,inputStates,layerStates,targets);
but not works, even not for the same sample data that it used for the train. The code was:
inputSeries = pollutionInputs;
targetSeries = pollutionTargets;
inputDelays = 1:2;
feedbackDelays = 1:2;
hiddenLayerSize = 10;
load('mynet', 'net')
[inputs,inputStates,layerStates,targets] = preparets(net,inputSeries,{},targetSeries);
outputs = net(inputs,inputStates,layerStates);
Where the final line produces the error:
Output argument "data" (and maybe others) not assigned during call to "C:\Program
Files\MATLAB\R2012b\toolbox\nnet\nnet\@network\sim.m>simData".
Error in network/sim (line 291)
[data,err] = simData(net,X,Xi,Ai,T,EW);
Error in network/subsref (line 17)
otherwise, v = sim(vin,subs{:});
Error in narx2 (line 71)
outputs = net(inputs,inputStates,layerStates);
What could cause the problem, and how I could use the saved and loaded network for new datas?
Thank you in advance!

Best Answer

1. Check the loaded net to make sure it has all the correct properties
net = net % NO SEMICOLON!
2. Sequentially remove ending semicolons to make sure the command line outputs at each stage makes sense.
Hope this helps.
Thank you for formally accepting my answer
Greg