To prepare your algorithms for code generation, MathWorks recommends that you choose a debugging strategy for detecting and correcting violations in your MATLAB® applications, especially if they consist of a large number of MATLAB files that call each other's functions. Here are two best practices:
|Debugging Strategy||What to Do||Pros||Cons|
Requires application tests that work from the bottom up
Lets you retain your top-level tests
Introduces extraneous code that you must remove after code verification, including:
To detect potential issues for MEX file building as you write
your MATLAB algorithm, add the
to the code that you want
fiaccel to compile.
Adding this directive indicates that you intend to generate code from
the algorithm and turns on detailed diagnostics during MATLAB code
Before you can successfully generate code from a MATLAB algorithm, you must verify that the algorithm does not contain syntax and semantics violations that would cause compile-time errors, as described in Detect and Debug Code Generation Errors.
fiaccel checks for all potential syntax
violations at compile time. When
errors or warnings, it automatically produces a code generation report
that describes the issues and provides links to the offending code.
See Code Generation Reports.
If your MATLAB code calls functions on the MATLAB path,
to compile these functions unless you declare them to be extrinsic.