MATLAB Compiler    

Controlling #line Directives in Output Code

#line preprocessing directives inform a C/C++ compiler that the C/C++ code was generated by another tool (MATLAB Compiler) and they identify the correspondence between the generated code and the original source code (M-file). You can use the #line directives to help debug your M-file(s). Most C language debuggers can display your M-file source code. These debuggers allow you to set breakpoints, single step, and so on at the M-file code level when you use the #line directives.

Use the line:setting option to include #line preprocessor directives in your generated C or C++ output. The possible values for setting are

Not specifying any line setting uses the default of off, which does not include any #line preprocessor directives in the generated C/C++ source.

Include #line Directives

To include #line directives in your generated C or C++ code, use

The Hello, World example produces the following code segment when this option is selected. (Note that several lines have been truncated for readability.)

In this example, Line 1 points to lines in the generated C code that were produced by line 1 from the M-file, that is

Line 3 points to lines in the C code that were produced by line 3 of the M-file, or


  Controlling Comments in Output Code Controlling Information in Run-Time Errors