Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Code Generation

Generate C code and MEX functions for toolbox functions

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.

Functions

saveCompactModelSave model object in file for code generation
loadCompactModelReconstruct model object from saved model for code generation

Topics

Code Generation Support, Usage Notes, and Limitations

View a list of code-generation-enabled statistics functions, and corresponding limitations and other notes.

Code Generation Workflows at Command Line

Generate code for Statistics and Machine Learning Toolbox functions involving model objects at the command line.

Code Generation Workflow Using MATLAB Coder App

Generate code for Statistics and Machine Learning Toolbox functions involving model objects by using the MATLAB Coder app.

C Code Generation and Classification Learner App

Generate code from a label prediction function that loads a classification model from Classification Learner App.

Specify Variable-Sized Arguments for Code Generation

Generate code from a label prediction function that is flexible with respect to the number of observations and the dimensions of other parameter values.

C Code Generation for Image Classifier

This example shows how to generate C code from a MATLAB function that classifies images of digits using a trained classification model.

Predict Class Labels Using MATLAB Function Block

Generate code from a Simulink® model that classifies data using an SVM model.

System Objects for Classification and Code Generation

Generate code from a System object™ for making predictions using a trained classification model, and use the System object in a Simulink model.

Predict Class Labels Using Stateflow

Generate code from a Stateflow® model that classifies data using a discriminant analysis classifier.

Human Activity Recognition Simulink Model for Smartphone Deployment

Generate code from a classification Simulink model prepared for deployment to a smartphone.

Was this topic helpful?