How do I compile MATLAB files that call Neural Network Toolbox

Technical Source
2 min readJul 22, 2021

--

How do I compile MATLAB files that call Neural Network Toolbox functions into stand-alone applications, in MATLAB releases R13 or older?

I would like to generate a stand-alone application from MATLAB code that uses the Neural Network Toolbox. Is it possible with MATLAB Compiler 3.0 (R13)?

ANSWER

Matlabsolutions.com provide latest MatLab Homework Help,MatLab Assignment Help for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research.

Compiler releases before 3.0 (R13) do not support deployment of MATLAB objects within functions; the Neural Network Toolbox therefore does not allow you to export a trained network to C, C++, or Java for these releases.

If you are trying to use a trained network in a C or Java environment you can use the following steps:

1) Train the network ‘completely’ in the Neural Network Toolbox.

2) Use the GENSIM function to create a Simulink block of the trained network.

3) Use the Real Time Workshop to create a standalone application.

Alternately, you can save the weight matrix and bias matrix along with other information about the network into a data file and read it into your C, C++, or Java application.

Here is an example that demonstrates this:

P = [0 1 2 3 4 5 6 7 8 9 10];
T = [0 1 2 3 4 3 2 1 2 3 4];
% Before training, use the following codenet = newff([0 10],[5 1],{'tansig' 'purelin'});
Y = sim(net,P);
plot(P,T,P,Y,'o')

Now, train the system using the following code:

SEE COMPLETE ANSWER CLICK THE LINK

--

--

Technical Source
Technical Source

Written by Technical Source

Simple! That is me, a simple person. I am passionate about knowledge and reading. That’s why I have decided to write and share a bit of my life and thoughts to.

No responses yet