Documentation

This is machine translation

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

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan 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

Generate code for Statistics and Machine Learning Toolbox functions including label prediction using classification models.

Code Generation Workflow for Exhaustive Searcher

Generate code for finding nearest neighbors using an exhaustive searcher model.

C Code Generation and Classification Learner

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

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.

Was this topic helpful?