coder
OpenMATLABCoderapp
Syntax
Description
coder
opens theMATLAB®Coder™app. To create a project, on theSelect Source Filespage, 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 clickOpen 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 theAll Settingstab, underAdvanced, setUse Embedded Coder featurestoNo
.
coder
opens theMATLAB Coderapp using the existing project namedprojectname
projectname.prj
.
coder -open
opens theMATLAB Coderapp using the existing project namedprojectname
projectname.prj
.
coder -build
builds the existing project namedprojectname
projectname.prj
.
coder -new
opens theMATLAB Coder应用程序创建一个项目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 theAll Settingstab, underAdvanced, setUse Embedded Coder featurestoNo
.
coder -ecoder false -new
opens theMATLAB Coder应用程序创建一个项目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 namedprojectname
-scriptscriptname
projectname.prj
to the equivalent script of MATLAB commands. The script is namedscriptname
.
If
scriptname
前女友ists,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 tocodegen
must be on the search path.
cfg
,ARGS
, andGLOBALS
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. Ifscriptname
specifies a file extension, the script file name includes the file extension. For example, ifscriptname
ismyscript.m
and the suffix is the default value_fixpt
, the script name ismyscript_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 theTest Numericsstep of the fixed-point conversion process.
coder -tocode
converts the existing project namedprojectname
projectname.prj
to the equivalent script of MATLAB commands. It writes the script to the Command Window.
coder -toconfig
前女友ports the code configuration settings stored in aMATLAB Coderproject file to a code configuration object. Executing this command returns a code configuration object corresponding toprojectname
projectname
. For more information on which code configuration object is returned for different project file settings, seeShare Build Configuration Settings.
returns a configuration object that contains the code configuration settings stored in aMATLAB Coderproject file. Executing this command returns a code configuration objectcfg
= coder('-toconfig','projectname
')cfg
corresponding toprojectname
. For more information on which code configuration object is returned for different project file settings, seeShare Build Configuration Settings.
coder -typeEditor
opens an empty Coder Type Editor dialog. If a dialog is already open, this command brings it to the front of the screen.
SeeCreate and Edit Input Types by Using the Coder Type Editor.
Examples
Input Arguments
Output Arguments
Limitations
The
coder
function is not supported inMATLAB Online™.
Tips
If you are sharing an Embedded Coder license, use
coder -ecoder false -new projectname
to create a project that does not require this license. If the Embedded Coder product is installed, the app creates the project with Embedded Coder features disabled. When these features are disabled, code generation does not require an Embedded Coder license. To enable Embedded Coder features, in the project build settings, on theAll Settingstab, underAdvanced, setUse Embedded Coder featurestoYes
.Creating a project or opening an existing project causes otherMATLAB Coderor Fixed-Point Converter projects to close.
If your installation does not include the Embedded Coder product, the Embedded Coder settings do not show. However, values for these settings are saved in the project file. If you open the project in an installation that includes the Embedded Coder product, you see these settings.
A Fixed-Point Converter project opens in the Fixed-Point Converter app. To convert the project to aMATLAB Coderproject, in the Fixed-Point Converter app:
Click
and selectReopen project as.
Select
MATLAB Coder
.
Alternatives
On theAppstab, in theCode Generationsection, clickMATLAB Coder.
Use the
codegen
function to generate code at the command line.
Version History
Introduced in R2011a