| Contents | Index |
| On this page… |
|---|
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 |
|---|---|---|---|
Bottom-up verification |
|
| Requires application tests that work from the bottom up |
Top-down verification |
| Lets you retain your top-level tests | Introduces extraneous code that you must remove after code verification, including:
|
To detect potential issues for MEX generation as you write your MATLAB algorithm, add the %#codegen directive 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 analysis (see Check Code for Errors and Warnings in the MATLAB Desktop Tools and Development Environment documentation).
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 Preparing MATLAB Algorithms for Code Generation.
fiaccel checks for all potential syntax violations at compile time. When fiaccel detects errors or warnings, it automatically produces a code generation report that describes the issues and provides links to the offending code. See Working with Fixed-Point Code Generation Reports.
If your MATLAB code calls functions on the MATLAB path, fiaccel attempts to compile these functions unless you declare them to be extrinsic.
![]() | Setting Up File Infrastructure and Paths | Setting MEX Compilation Options | ![]() |

Learn how to apply early verification to your development process through these technical resources.
How much time do you spend on testing to ensure implementation meets system-level requirements?
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |