Automated Fixed-Point Conversion in MATLAB
The Fixed-Point Converter app enables you to convert floating-point MATLAB® code to fixed-point MATLAB code.
Use fiaccel
to convert floating-point MATLAB code to fixed-point MATLAB code at the command line.
Apps
Fixed-Point Converter | (Not recommended) Convert MATLAB code to fixed point |
Functions
fiaccel | Accelerate fixed-point code or convert floating-point MATLAB code to fixed-point MATLAB code |
coder.config | Create configuration object for fixed-point or single-precision conversion |
coder.approximation | Create function replacement configuration object |
coder.allowpcode | Control code generation from P-code files |
coder.const | Fold expressions into constants in generated code |
coder.extrinsic | Declare function as extrinsic and execute it in MATLAB |
coder.float2fixed.skip | Exclude functions from fixed-point conversion (Since R2024b) |
coder.inline | Control inlining of current function in generated code |
coder.inlineCall | Inline called function in generated code (Since R2024a) |
coder.load | Load compile-time constants from MAT-file or ASCII file |
coder.newtype | Create coder.Type object to represent type of an entry-point
function input |
coder.nonInlineCall | Prevent inlining of called function in generated code (Since R2024a) |
coder.nullcopy | Declare uninitialized variables in generated code |
coder.resize | Resize coder.Type object |
coder.target | Determine if code generation target is specified target |
coder.typeof | Create coder.Type object to represent the type
of an entry-point function input |
coder.unroll | Unroll for -loop by making a copy of
the loop body for each loop iteration |
coder.varsize | Resolve size mismatch errors and declare upper bounds |
Classes
coder.mexconfig | Code acceleration configuration object for use with
fiaccel |
coder.FixPtConfig | Floating-point to fixed-point conversion configuration object |
coder.ArrayType | Represent set of MATLAB arrays acceptable for input specification |
coder.Constant | Specification of constant value for code generation |
coder.EnumType | Represent set of MATLAB enumerations acceptable for input specification |
coder.FiType | Represent set of MATLAB fixed-point arrays acceptable for input specification |
coder.PrimitiveType | Represent set of logical, numeric, or character arrays acceptable for input specification |
coder.StructType | Represent set of MATLAB structure arrays acceptable for input specification |
coder.Type | Represent set of MATLAB values acceptable for input specification |
Topics
Automated Fixed-Point Conversion Workflow
- Decide Which Workflow Is Right for Your Application
Learn the benefits of each conversion workflow to help you decide which one best fits your needs. - Fixed-Point Conversion Workflows
Learn which fixed-point conversion method best matches your end goal and your level of fixed-point expertise. - Automated Fixed-Point Conversion
Using the Fixed-Point Converter app for automated fixed-point conversion. - Automated Fixed-Point Conversion Best Practices
Generate fixed-point code according to best practices. - Propose Data Types Based on Simulation Ranges Using the Fixed-Point Converter App
Propose fixed-point data types based on simulation ranges using the Fixed-Point Converter app. - Propose Data Types Based on Derived Ranges Using the Fixed-Point Converter App
Propose fixed-point data types based on static ranges using the Fixed-Point Converter app. - Convert Fixed-Point Conversion Project to MATLAB Scripts
Use project settings for fixed-point conversion at the command line.
Propose Fixed-Point Types
- Specify Type Proposal Options
Specify options when proposing types for automated fixed-point conversion. - View and Modify Variable Information
View and modify variable information for fixed-point conversion. - Detect Unexecuted and Constant-Folded Code
Learn how the app detects code that is not executed or code that is constant folded during simulation of your test file.
Convert to Fixed Point
- Generated Fixed-Point Code
Avoid issues with generated fixed-point code. - Replacing Functions Using Lookup Table Approximations
Generate lookup table approximations to replace custom functions or functions that are not supported for fixed point. - Replace the exp Function with a Lookup Table
Replace a function with a lookup table approximation in fixed-point code generated with the Fixed-Point Converter app. - Replace a Custom Function with a Lookup Table
Replace a custom function with a lookup table approximation function by using the Fixed-Point Converter app.
Verify Fixed-Point Conversion
- Visualize Differences Between Floating-Point and Fixed-Point Results
Use a custom plot function to compare the behavior of the generated fixed-point code against the behavior of the original floating-point MATLAB code. - Enable Plotting Using the Simulation Data Inspector
Inspect and compare floating-point and fixed-point logged input and output data. - Custom Plot Functions
Visualize numerical differences during fixed-point conversion. - Detect Overflows
Detect overflows using the app.
Supported Language Features
- MATLAB Language Features Supported for Automated Fixed-Point Conversion
Learn which language features are and are not supported for automated fixed-point conversion. - Convert Code Containing Global Variables to Fixed-Point
Convert MATLAB code using global variables to fixed-point using the app. - Convert Code Containing Structures to Fixed Point
Convert a MATLAB algorithm containing structures to fixed point using the Fixed-Point Converter app. - Generate Fixed-Point MATLAB Code for Multiple Entry-Point Functions
Generate fixed-point code for multiple entry-point functions using the Fixed-Point Converter app. - Fixed-Point Code for MATLAB Classes
Use supported constructs and coding style best practices for fixed-point conversion of MATLAB classes. - Convert Code Containing Global Data to Fixed Point
Convert MATLAB code using global variables to fixed-point programmatically. - Convert Identical Functions Called with Different Data Types
Convert a MATLAB algorithm containing specialized functions to fixed point using the Fixed-Point Converter app. - Convert dsp.FIRFilter Object to Fixed-Point Using the Fixed-Point Converter App
Convert adsp.FIRFilter
System object™, which filters a high-frequency sinusoid signal, to fixed-point using the Fixed-Point Converter app. - System Objects Supported by Fixed-Point Converter App
Use the Fixed-Point Converter app to automatically propose and apply data types for commonly used system objects.
Command Line Workflow
- Propose Data Types Based on Simulation Ranges Using the fiaccel Function
Propose fixed-point data types based on simulation ranges using thefiaccel
function. - Propose Data Types Based on Derived Ranges Using the fiaccel Function
Propose fixed-point data types based on static ranges using thefiaccel
function. - Detect Overflows
Detect overflows at the command line. - Replace the exp Function with a Lookup Table
Replace a function with a lookup table approximation in fixed-point code generated with thefiaccel
function. - Replace a Custom Function with a Lookup Table
Replace a custom function with a lookup table approximation function by using thefiaccel
function. - Enable Plotting Using the Simulation Data Inspector
Inspect and compare floating-point and fixed-point logged input and output data. - Visualize Differences Between Floating-Point and Fixed-Point Results
Use a custom plot function to compare the behavior of the generated fixed-point code against the behavior of the original floating-point MATLAB code.
Troubleshooting
Avoid issues with generated fixed-point code.
Data Type Issues in Generated Code
Highlight potential data type issues in report.
Debug Numerical Issues in Fixed-Point Conversion Using Variable Logging
Learn how to debug your fixed-point code when you need more than out of the box conversion.
Why Does the Fixed-Point Converter App Not Propose Data Types for System Objects?
Troubleshoot missing data type proposals for System objects.
Slow Operations in the Fixed-Point Converter App
Determine whether code generation readiness screening is causing slow operations in the app.