Open MATLAB Coder app
coder
opens the MATLAB® Coder™ app.
To create a project, on the Select Source Files page,
provide the entry-point file names. The app creates a project with
a default name that is the name of the first entry-point file. To
open an existing project, on the app toolbar, click
, and then click Open
existing project.
If the Embedded Coder® product is installed, when the app
creates a project, it enables Embedded Coder features. When Embedded Coder features
are enabled, code generation requires an Embedded Coder license.
To disable Embedded Coder features, in the project build settings,
on the All Settings tab,
under Advanced, set Use Embedded Coder
features to No
.
coder
opens
the MATLAB Coder app using the existing project named projectname
projectname.prj
.
coder -open
opens
the MATLAB Coder app using the existing project named projectname
projectname.prj
.
coder -build
builds
the existing project named projectname
projectname.prj
.
coder -new
opens
the MATLAB Coder app creating a project named projectname
projectname.prj
.
If the Embedded Coder product is installed, the app creates the
project with Embedded Coder features enabled. To disable these
features, in the project build settings, on the All
Settings tab, under Advanced, set Use
Embedded Coder features to No
.
coder -ecoder false -new
opens
the MATLAB Coder app creating a project named projectname
projectname.prj
.
The app creates the project with Embedded Coder features disabled
even if the Embedded Coder product is installed.
coder -tocode
converts
the existing project named projectname
-script scriptname
projectname.prj
to the
equivalent script of MATLAB commands. The script is named scriptname
.
If scriptname
exists, coder
overwrites
it.
The script reproduces the project build configuration in a configuration object and builds the project. The script:
Creates a configuration object named cfg
.
Defines the variable ARGS
for function
input types.
Defines the variable GLOBALS
for
global data initial values.
Runs the codegen
command. When
you run the script, the entry-point functions that are arguments to codegen
must
be on the search path.
cfg
, ARGS
, and GLOBALS
appear
in the base workspace only after you run the script.
If the project includes automated fixed-point conversion, coder
generates
two scripts:
A script scriptname
that contains
the MATLAB commands to:
Create a code configuration object that has the same settings as the project.
Run the codegen
command to convert
the fixed-point MATLAB function to a fixed-point C function.
A script whose file name is a concatenation of the
name specified by scriptname
and the generated
fixed-point file name suffix specified by the project file. If scriptname
specifies
a file extension, the script file name includes the file extension.
For example, if scriptname
is myscript.m
and
the suffix is the default value _fixpt
, the script
name is myscript_fixpt.m
.
This script contains the MATLAB commands to:
Create a floating-point to fixed-point conversion configuration object that has the same fixed-point conversion settings as the project.
Run the codegen
command to convert
the floating-point MATLAB function to a fixed-point MATLAB function.
For a project that includes fixed-point conversion, before converting the project to scripts, complete the Test Numerics step of the fixed-point conversion process.
coder -tocode
converts
the existing project named projectname
projectname.prj
to
the equivalent script of MATLAB commands. It writes the script
to the Command Window.
On the Apps tab, in the Code Generation section, click MATLAB Coder.
Use the codegen
function
to generate code at the command line.