Main Content

Best Practices for Working with the MATLAB Function Block in Automated Fixed-Point Conversion Workflows

Follow these best practices when using MATLAB Function blocks with automated fixed-point conversion workflows, including the Fixed-Point Tool, DataTypeWorkflow.Converter, and fxpopt.

  • Do not edit the fixed-point variant of your MATLAB Function block algorithm. Use the code view to edit the floating-point variant of your MATLAB® code and reconvert to fixed-point data types.

  • For a successful conversion, only use modeling constructs supported for automated fixed-point conversion. For a list of the supported modeling constructs, see MATLAB Language Features Supported for Automated Fixed-Point Conversion.

  • While collecting range information, do not edit the MATLAB code in the MATLAB Function block. Editing the code will cause problems if you try to merge results.

  • During the fixed-point conversion process using the Fixed-Point Tool, do not use the "Save As" option to save the MATLAB Function block with a different name. If you do, you might lose existing results for the original block.

Unsupported MATLAB Function Blocks Features

These MATLAB Function block features are not supported for automated fixed-point conversion workflows.

Identify and Replace Unsupported Functions in MATLAB Function Blocks

Some functions used in MATLAB Function blocks, such as sinh and exp, are not supported for automated fixed-point conversion. In the Fixed-Point Tool, unsupported modeling constructs are flagged in the preparation stage of conversion by the MATLAB Function Block Best Practices check.

In R2025a: In the command-line workflow, use the getUnsupportedFunctionsForSystem function to identify unsupported functions in MATLAB Function blocks. Use the DataTypeWorkflow.FunctionReplacement object to specify and manage custom function or lookup table replacements for unsupported functions during data type conversion using DataTypeWorkflow.Converter.

See Also

Topics