coder - Open MATLAB

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

Syntax

Description

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 Action menu icon, and then click .

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 Settings tab, underAdvanced, set Use Embedded Coder features toNo.

coder [projectname](#bt261ix-1-projectname) opens the MATLAB Coder app using the existing project namedprojectname.prj.

coder -open [projectname](#bt261ix-1-projectname) opens the MATLAB Coder app using the existing project namedprojectname.prj.

example

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

example

coder -new [projectname](#bt261ix-1-projectname) opens the MATLAB Coder app creating a project named 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, underAdvanced, set Use Embedded Coder features toNo.

example

coder -ecoder false -new [projectname](#bt261ix-1-projectname) opens theMATLAB Coder app creating a project named projectname.prj. 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.prj to the equivalent script of MATLAB commands. The script is named scriptname.

If the project includes automated fixed-point conversion,coder generates two scripts:

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.

example

coder -tocode [projectname](#bt261ix-1-projectname) converts the existing project named projectname.prj 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 a 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 an existing MATLAB Coder project

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

coder -open my_coder_project

Build a MATLAB Coder project

Build the MATLAB Coder project named my_coder_project.

coder -build my_coder_project

Create a MATLAB Coder project

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

coder -new my_coder_project

Convert a MATLAB Coder project to a MATLAB script

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

coder -tocode my_coder_project -script my_script.m

Create code configuration object from MATLAB Coder project

Define a MATLAB function, myadd, that returns the sum of two values.

function y = myadd(u,v) %#codegen y = u + v; end

Create a MATLAB Coder project myadd.prj:

At the MATLAB command line, run this command:

cfg = coder('-toconfig','myadd.prj');

The code generator creates a coder.MexCodeConfig object cfg that contains the code configuration settings stored in myadd.prj.

Inspect the properties of cfg.

cfg =

Description: 'class MexCodeConfig: MEX configuration objects with C code.'
Name: 'MexCodeConfig'

-------------------------------- Report -------------------------------

                  GenerateReport: true
                    LaunchReport: false
               ReportInfoVarName: ''
      ReportPotentialDifferences: false

------------------------------- Debugging -----------------------------

                 EchoExpressions: true
                 EnableDebugging: false
              EnableMexProfiling: false

---------------------------- Code Generation --------------------------

                  ConstantInputs: 'CheckValues'
                       EnableJIT: false
             FilePartitionMethod: 'MapMFileToCFile'
                     GenCodeOnly: false
HighlightPotentialRowMajorIssues: true
              PostCodeGenCommand: ''
         PreserveArrayDimensions: false
                        RowMajor: false
                      TargetLang: 'C'

------------------------ Language And Semantics -----------------------

       CompileTimeRecursionLimit: 50
          ConstantFoldingTimeout: 40000
         EnableDynamicMemoryAllocation: true
DynamicMemoryAllocationThreshold: 65536
        EnableAutoExtrinsicCalls: true
          EnableRuntimeRecursion: true
            EnableVariableSizing: true
                  ExtrinsicCalls: true
            GlobalDataSyncMethod: 'SyncAlways'
           InitFltsAndDblsToZero: true
           PreserveVariableNames: 'None'
       SaturateOnIntegerOverflow: true

------------------------- C++ Language Features -----------------------

                    CppNamespace: ''

----------------- Safety (disable for faster execution) ---------------

                 IntegrityChecks: true
            ResponsivenessChecks: true

---------------- Function Inlining and Stack Allocation ---------------

                InlineStackLimit: 4000
                 InlineThreshold: 10
              InlineThresholdMax: 200
                   StackUsageMax: 200000

----------------------------- Optimizations ---------------------------

                    EnableMemcpy: true
                    EnableOpenMP: true
                 MemcpyThreshold: 64

------------------------------- Comments ------------------------------

                GenerateComments: true
            MATLABSourceComments: false

------------------------------ Custom Code ----------------------------

                CustomHeaderCode: ''
                   CustomInclude: ''
               CustomInitializer: ''
                   CustomLibrary: ''
                    CustomSource: ''
                CustomSourceCode: ''
                CustomTerminator: ''
               ReservedNameArray: ''

Input Arguments

collapse all

projectname — Name of MATLAB Coder project

project name

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

scriptname — Name of script file

script name

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

cfg — Code configuration object

coder.MexCodeConfig | coder.CodeConfig | coder.EmbeddedCodeConfig

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

Limitations

Tips

Alternatives

Version History

Introduced in R2011a