Specify Properties of Entry-Point Function Inputs
Why You Must Specify Input Properties
Fixed-Point Designer™ must determine the properties of all variables in the MATLAB® files at compile time. To infer variable properties in MATLAB files, Fixed-Point Designer must be able to identify the properties of the inputs to the primary function, also known as the top-level or entry-point function. Therefore, if your primary function has inputs, you must specify the properties of these inputs, to Fixed-Point Designer. If your primary function has no input parameters, Fixed-Point Designer can compile your MATLAB file without modification. You do not need to specify properties of inputs to local functions or external functions called by the primary function.
Note
Your primary function cannot be within a MATLAB namespace. Create a wrapper function as the primary function outside the namespace. Call the desired function within the new function as the primary function.
Methods of Input-Type Specification
Method | Advantages | Disadvantages |
---|---|---|
Define Input Properties at the Command Line Note You cannot use this method if you define input properties
by using
|
|
|
|
|
Properties to Specify
If your primary function has inputs, you must specify the following properties for each input.
For | Specify properties | ||||
---|---|---|---|---|---|
Class | Size | Complexity | numerictype | fimath | |
Fixed-point inputs |
|
|
|
|
|
Each field in a structure input | |||||
Other inputs |
|
|
|
Default Property Values
Fixed-Point Designer assigns the following default values for properties of primary function inputs.
Property | Default |
---|---|
class | double |
size | scalar |
complexity | real |
numerictype | No default |
fimath | MATLAB default fimath object |
Supported Classes
The following table presents the class names supported by Fixed-Point Designer.
Class Name | Description |
---|---|
logical | Logical array of true and false values |
char | Character array |
int8 | 8-bit signed integer array |
uint8 | 8-bit unsigned integer array |
int16 | 16-bit signed integer array |
uint16 | 16-bit unsigned integer array |
int32 | 32-bit signed integer array |
uint32 | 32-bit unsigned integer array |
int64 | 64-bit signed integer array |
uint64 | 64–bit unsigned integer array |
single | Single-precision floating-point or fixed-point number array |
double | Double-precision floating-point or fixed-point number array |
struct | Structure array |
embedded.fi | Fixed-point number array |
Rules for Specifying Properties of Primary Inputs
When specifying the properties of primary inputs, follow these rules:
The order of elements in the cell array must correspond to the order in which inputs appear in the primary function signature. For example, the first element in the cell array defines the properties of the first primary function input.
To generate fewer arguments than those arguments that occur in the MATLAB function, specify properties for only the number of arguments that you want in the generated function.
If the MATLAB function has input arguments, to generate a function that has no input arguments, pass an empty cell array to
-args
.For each primary function input whose class is fixed point (
fi
), specify the inputnumerictype
andfimath
properties.For each primary function input whose class is
struct
, specify the properties of each of its fields in the order that they appear in the structure definition.If you generate a MEX, SIL, or PIL function that accepts an empty array with a given shape, the generated function accepts empty arrays of other shapes as well. The MEX, SIL, or PIL function reshapes the empty run-time input array to match the shape of the array that was specified at code generation time.