coder.getArgTypes
Determine types of function input arguments by executing test file
Syntax
Description
returns a structure containing cell arrays of struct_of_types = coder.getArgTypes(test_fcn,fcns)coder.Type objects determined by executing
test_fcn. The function test_fcn must call
the specified entry-point functions listed in fcns. 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).
Examples
Input Arguments
Output Arguments
Tips
coder.getArgTypesreturns the input types of the function arguments, similar to the Automatically Define Input Types step in the app.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.getArgTypescannot determine the input types for this function.coder.getArgTypesmight not compute the ideal type for your application. For example, you might want the size to be unbounded. Thecoder.getArgTypesfunction returns a bound based on the largest input. To adjust the sizes of the returned types, usecoder.resize.For some combinations of inputs,
coder.getArgTypescannot 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.getArgTypesgenerates 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
codegenfunction using the-argsoption.
Alternatives
Version History
Introduced in R2012a