The following script sets up the creation of a pre-trained network and stores it in a MAT-file ('pre_trained_net.mat').
P = [1 2 3 4 5];
T = [1 2 3 4 3];
net = newff(P,T,5);
net.trainParam.epochs = 50;
net = train(net,P,T);
save pre_trained_net net
The following function utilizing the pre-trained network can be compiled into a stand-alone application:
output = sim(net,input)
The following command may be used to compile the above function into a stand-alone application:
The compiled application may be called from the system command line as follows to generate output for new input:
For your convenience, find attached 'pre_trained_net.mat' and 'compiled_network.exe'. The executable was compiled using MATLAB Compiler 4.10 (R2009a) on Windows XP. These files can always be created as described earlier.