In Matlab, How to use already trained neural network on real time values?

1.2k Views Asked by At

Using nntool(Neural Network Manager) in Matlab, we have created a neural network named network1, the network type is Feed Forward backprop. Training function is TRAINLM, learning function is LEARNGDM, performance function is MSE. No. of layers are 2 and transfer function is TRANSIG. No. of Inputs is 2.

We have trained it using known datasets.

Now, we want to use this trained Neural Network on real time values(dynamically one by one) to get the output.

We are unable to use the network on real time values. So, please guide us through the steps to use trained neural network on real time values.

2

There are 2 best solutions below

0
On

if you created a ann via

network1 = feedforwardnet;

or something of that kind and then trained it with your known data, you should be able to use said net via

outputs = network1(inputs);
0
On

You can create a function from the neural network that you have trained and use it as regular MATLAB functions. You can either create it with genFun command or using the GUI in neural network toolbox.

genFunction(net,pathname)

If you want the function to accept only matrix elements you should use this command:

genFunction(net,pathname,'MatrixOnly','yes')