Determine types of function input arguments by executing test file
returns a structure containing cell arrays of struct_of_types
= coder.getArgTypes(test_fcn
,{fcn_1,...,fcn_n
})coder.Type
objects determined by executing
test_fcn
. The function test_fcn
must call
the specified entry-point functions fcn_1
through
fcn_n
. Input arguments to these functions construct the
returned types. The returned structure contains one field for each function. The
field name is the same as the name of the corresponding function.
returns a structure even though there is only one entry-point function. The property
struct_of_types
= coder.getArgTypes(test_fcn
,fcn
,
'uniform',struct_flag
)uniform
defines whether the output array type is a structure
of cell arrays (true) or a cell array (false).
Before using coder.getArgTypes
, run the test function in
MATLAB to verify that it provides the expected results.
Verify that the test function calls the specified entry-point functions with
input data types suitable for your run-time environment. If the test function
does not call a specified function, coder.getArgTypes
cannot determine the input types for this function.
coder.getArgTypes
might not compute the ideal type for
your application. For example, you might want the size to be unbounded. The
coder.getArgTypes
function returns a bound based on the
largest input. To adjust the sizes of the returned types, use
coder.resize
.
For some combinations of inputs, coder.getArgTypes
cannot
produce a valid type. For example, if the test function calls the entry-point
function with single inputs, and then calls it with double inputs,
coder.getArgTypes
generates an error because there is
no single type that can represent both
calls.
When you generate code for the MATLAB function, use the returned types as example inputs by passing them
to the codegen
function using the -args
option.