Main Content

coder

Open MATLAB Coder app

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 projectname opens project projectname.coderprj in the MATLAB Coder app.

coder -open projectname opens project projectname.coderprj in the MATLAB Coder app.

example

coder -build projectname builds the existing project projectname.coderprj.

example

coder -new projectname opens the MATLAB Coder app and creates a project named projectname.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.

example

coder -ecoder false -new projectname opens the MATLAB Coder app and creates a project named projectname.coderprj. The app creates the project with Embedded Coder features disabled even if the Embedded Coder product is installed.

coder -tocode projectname -script scriptname converts the existing project named projectname.coderprj 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 inputTypes for function input types.

    • Defines the variable globalVariables 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, inputTypes, and globalVariables appear in the base workspace only after you run the script.

example

coder -tocode projectname converts the existing project named projectname.coderprj to the equivalent script of MATLAB commands. It writes the script to the Command Window.

coder -toconfig projectname 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 projectname. For more information on which code configuration object is returned for different project file settings, see Share Build Configuration Settings.

cfg = coder("-toconfig","projectname") 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 corresponding to projectname. For more information on which code configuration object is returned for different project file settings, see Share Build Configuration Settings.

example

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

collapse all

Open the MATLAB Coder app using the existing MATLAB Coder project named my_coder_project.

coder -open my_coder_project

Build the MATLAB Coder project named my_coder_project.

coder -build my_coder_project

Open the MATLAB Coder app and create a project named my_coder_project.

coder -new my_coder_project

Convert the MATLAB Coder project named my_coder_project.coderprj to the MATLAB script named myscript.m.

coder -tocode my_coder_project -script my_script.m

Create code configuration object cfg corresponding to the configuration settings stored in my_coder_project.

cfg = coder("-toconfig","my_coder_project");

Input Arguments

collapse all

Name of MATLAB Coder project that you want to create, open, or build. The project name must not contain spaces.

Name of script that you want to create when using the -tocode option with the -script option. The script name must not contain spaces.

Output Arguments

collapse all

Code configuration object that contains the configuration settings stored in a MATLAB Coder project file.

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.

  • 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 codegen function to generate code at the command line.

Version History

Introduced in R2011a

expand all