Is it possible to use models trained with Matlab classification learners outside Matlab, such as in java

2 views (last 30 days)
I am using Classification Learners in apps, to classify my data, and it seems bagged trees and Linear SMV does the best prediction. Therefore, I want to export the model trained with these algorithms and use it in my custom Java application. I wonder, is it possible to export the trainedClassifier model outside of Matlab, if it is so, how can I do it? Thank you,

Answers (1)

Abhisek Roy
Abhisek Roy on 31 May 2016
Hi Emin,
It is possible to deploy your MATLAB code to a Java platform by writing C wrapping code to enable the generated C code to be used with Java Native Interface (JNI). Please refer to the following link which gives you an example of how to generate C Code from MATLAB for Use with Java Applications -
http://www.mathworks.com/company/newsletters/articles/generating-c-code-from-matlab-for-use-with-java-and-net-applications.html
However, the functions which you have used in the MATLAB code should be Code generable as the code need to be converted to equivalent C Code to use it outside MATLAB. Please refer to the following link which gives you the full list of functions, classes, and System objects for which you can generate C/C++ code -
http://www.mathworks.com/help/coder/ug/functions-supported-for-code-generation--categorical-list.html#btwz3ma
Regards, Abhisek

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!