MATLAB Compiler | ![]() ![]() |
Listing All Formatting Options
To view a list of all available formatting options, use
Setting Page Width
Use the page-width:n
option to set the maximum width of the generated code to n
, an integer. The default is 80 columns wide, so not selecting any page width formatting option will automatically limit your columns to 80 characters.
Setting the page width to a desired value does not guarantee that all generated lines of code will not exceed that value. There are cases where, due to indentation perhaps, a variable name may not fit within the width limit. Since variable names cannot be split, they may extend beyond the set limit. Also, to maintain the syntactic integrity of the original M source, annotations included from the M source file are not wrapped.
Note
When using -A line:on , which is the default with the MATLAB add-in for Visual Studio, the page width is set as large as possible to support source-level debugging and this setting is ignored.
|
Default Width
Not specifying a page width formatting option uses the default of 80. Using
0 1 2 3 4 5 6 7 8 12345678901234567890123456789012345678901234567890123456789012345678901234567890 for (mclForStart( &viter__, mlfScalar(1), mclVa(numPoints, "numPoints"), NULL); mclForNext(&viter__, &i); ) { /* * startPoint = floor((corners(theRand(i),:)+startPoint)/2); */ mclMline(21); mlfAssign( &startPoint, mlfFloor( mclMrdivide( mclPlus( mlfIndexRef( mclVv(corners, "corners"), "(?,?)", mlfIndexRef( mclVv(theRand, "theRand"), "(?)", mclVv(i, "i")), mlfCreateColonIndex()), mclVv(startPoint, "startPoint")), mlfScalar(2)))); . . .
Page Width = 40
This example specifies a page width of 40:
The segment of generated code is
0 1 2 3 4 5 6 7 8 12345678901234567890123456789012345678901234567890123456789012345678901234567890 mclMline(13); mlfAssign( &theImage, mlfZeros( mlfScalar(1000), mlfScalar(1000), NULL)); /* * * corners = [866 1;1 500;866 1000]; */ mclMline(15); mlfAssign( &corners, mlfDoubleMatrix( 3, 2, _array0_, (double *)NULL)); /* * startPoint = [866 1]; */ mclMline(16); mlfAssign( &startPoint, mlfDoubleMatrix( 1, 2, _array1_, (double *)NULL)); /* * theRand = rand(numPoints,1); */ mclMline(17); mlfAssign( &theRand, mlfNRand( 1, mclVa(numPoints, "numPoints"), mlfScalar(1), NULL)); . . .
![]() | Formatting Compiler-Generated Code | Setting Indentation Spacing | ![]() |