MATLAB® Coder™ generates standalone, ANSI-compliant C code or MEX functions from Statistics and Machine Learning Toolbox™ functions that support code generation. For example, you can classify new observations on hardware devices that cannot run MATLAB by deploying a trained, binary or multiclass support vector machine classification model to the device using code generation.
View a list of code-generation-enabled statistics functions, and corresponding limitations and other notes.
Generate code for Statistics and Machine Learning Toolbox functions involving model objects at the command line.
Generate code for Statistics and Machine Learning Toolbox functions involving model objects by using the MATLAB Coder app.
Generate code from a label prediction function that loads a classification model from Classification Learner App.
Generate code from a label prediction function that is flexible with respect to the number of observations and the dimensions of other parameter values.
This example shows how to generate C code from a MATLAB function that classifies images of digits using a trained classification model.
Generate code from a Simulink® model that classifies data using an SVM model.
Generate code from a System object™ for making predictions using a trained classification model, and use the System object in a Simulink model.
Generate code from a Stateflow® model that classifies data using a discriminant analysis classifier.
Generate code from a classification Simulink model prepared for deployment to a smartphone.