coder
Open MATLAB Coder app
Syntax
Description
coder or matlabcoder opens the MATLAB®
Coder™ app. To create a new project, in the Create MATLAB Coder Project dialog box,
give the new project a name and select a location. To open an existing project, click
Open and navigate to the project file.
When the app creates a project, the app enables Embedded Coder® features if the Embedded Coder product is installed. When Embedded Coder features are enabled, code generation requires an Embedded Coder license. To disable Embedded Coder features, open the MEX Code Generation Settings or Standalone Code Generation Settings dialog box. On the Advanced pane, clear the Use Embedded Coder features check box.
coder opens project
projectnameprojectname.coderprj in the MATLAB
Coder app.
coder -open opens project
projectnameprojectname.coderprj in the MATLAB
Coder app.
coder -build builds the existing
project projectnameprojectname.coderprj.
coder -new opens the MATLAB
Coder app and creates a project named projectnameprojectname.coderprj.
If the app finds a function with the same name as the projectname in
the working directory, the app adds this function to projectname as an
entry-point function.
If the Embedded Coder product is installed, the app creates a new project with Embedded Coder features enabled. To disable Embedded Coder features, open the MEX Code Generation Settings or Standalone Code Generation Settings dialog box. On the Advanced pane, clear the Use Embedded Coder features check box.
coder -ecoder false -new opens the
MATLAB
Coder app and creates a project named projectnameprojectname.coderprj. 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 scriptnameprojectname.coderprj to the
equivalent script of MATLAB commands. The script is named scriptname.
If
scriptnameexists,coderoverwrites 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
inputTypesfor function input types.Defines the variable
globalVariablesfor global data initial values.Runs the
codegencommand. When you run the script, the entry-point functions that are arguments tocodegenmust be on the search path.
cfg,inputTypes, andglobalVariablesappear in the base workspace only after you run the script.
coder -tocode converts the
existing project named projectname projectname.coderprj to the equivalent script of
MATLAB commands. It writes the script to the Command Window.
coder -toconfig exports the code
configuration settings stored in the MATLAB
Coder project file to a code configuration object. Executing this command returns a
code configuration object corresponding to projectnameprojectname. For more
information on which code configuration object is returned for different project file
settings, see Share Build Configuration Settings.
returns a configuration object that contains the code configuration settings stored in a
MATLAB
Coder project file. Executing this command returns a code configuration object
cfg = coder("-toconfig","projectname")cfg corresponding to projectname. For more
information on which code configuration object is returned for different project file
settings, see Share Build Configuration Settings.
coder -typeEditor opens an empty Coder Type Editor dialog box. If a
dialog box is already open, this command brings it to the front of the screen.
See Create and Edit Input Types by Using the Coder Type Editor.
Examples
Input Arguments
Output Arguments
Tips
If you are sharing an Embedded Coder license, use
coder -ecoder false -new projectnameto 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.Before creating a project or opening an existing project, the app closes any currently open MATLAB Coder project.
If your installation does not include the Embedded Coder product, Embedded Coder settings are not displayed. 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.
Alternatives
On the Apps tab, in the Code Generation section, click MATLAB Coder.
Use the
codegenfunction to generate code at the command line.