coder - Open MATLAB

        Coder app - MATLAB ([original](http://www.mathworks.com/help/coder/ref/coder.html)) ([raw](?raw))

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, clickOpen 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](#bt261ix-1-projectname) opens projectprojectname.coderprj in the MATLAB Coder app.

coder -open [projectname](#bt261ix-1-projectname) opens projectprojectname.coderprj in the MATLAB Coder app.

example

coder -build [projectname](#bt261ix-1-projectname) builds the existing project projectname.coderprj.

example

coder -new [projectname](#bt261ix-1-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](#bt261ix-1-projectname) opens theMATLAB 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](#bt261ix-1-projectname) -script [scriptname](#bt261ix-1-scriptname) converts the existing project named projectname.coderprj to the equivalent script of MATLAB commands. The script is named scriptname.

example

coder -tocode [projectname](#bt261ix-1-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](#bt261ix-1-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](#mw%5F78d5bbb9-cc12-4d94-8dfc-8c2f1aa380db) = coder("-toconfig","[projectname](#bt261ix-1-projectname)") returns a configuration object that contains the code configuration settings stored in aMATLAB Coder project file. Executing this command returns a code configuration objectcfg corresponding to projectname. For more information on which code configuration object is returned for different project file settings, see Share Build Configuration Settings.

example

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 aMATLAB Coder project file.

Tips

Alternatives

Version History

Introduced in R2011a

expand all

The coder function creates code generation project files with a.coderprj extension, instead of with a .prj extension. If you open a MATLAB Coder project file created before R2025a by using the coder function, the code generator saves a copy of the PRJ file to a CODERPRJ file. If you save changes to your project, the changes are saved to the CODERPRJ file, not the PRJ file. In some cases, the app is unable to migrate parameters that are specific to a hardware support package from the PRJ file to the CODERPRJ file. If you use a hardware support package, verify that the configuration parameters are correct before generating code.