Documentation

Compilation Directive %#codegen

Add the %#codegen directive (or pragma) to your function after the function signature to indicate that you intend to generate code for the MATLAB® algorithm. Adding this directive instructs the MATLAB code analyzer to help you diagnose and fix violations that would result in errors during code generation.

function y = my_fcn(x) %#codegen

....

    Note:   The %#codegen directive is not necessary for MATLAB Function blocks. Code inside a MATLAB Function block is always intended for code generation. The %#codegen directive, or the absence of it, does not change the error checking behavior.

Was this topic helpful?