Main Content

Automatically Define Input Types by Using the App

If you specify a test file that calls the project entry-point functions, theMATLAB®Coder™app can infer the input argument types by running the test file. If a test file calls an entry-point function multiple times with different size inputs, the app takes the union of the inputs. The app infers that the inputs are variable size, with an upper bound equal to the size of the largest input.

Before using the app to automatically define function input argument types, you must add at least one entry-point file to your project. You must also specify code that calls your entry-point functions with the expected input types. It is a best practice to provide a test file that calls your entry-point functions. The test file can be either a MATLAB function or a script. The test file must call the entry-point function at least once.

To automatically define input types:

  1. On theDefine Input Typespage, specify a test file. Alternatively, you can enter code directly.

  2. ClickAutodefine Input Types.

    The app runs the test file and infers the types for entry-point input arguments. The app displays the inferred types.

Note

If you automatically define the input types, the entry-point functions must be in a writable folder.

If your test file does not call an entry-point function with different size inputs, the resulting type dimensions are fixed-size. After you define the input types, you can specify and apply rules for making type dimensions variable-size when they meet a size threshold. SeeMake Dimensions Variable-Size When They Meet Size Threshold.

TheMATLAB Coderapp is not supported inMATLAB Online™.