Manage Required Files in Compiler Project

Dependency Analysis

The compiler uses a dependency analysis function to automatically determine what additional MATLAB® files are required for the application to compile and run. These files are automatically compiled into the generated binary. The compiler does not generate any wrapper code allowing direct access to the functions defined by the required files.

Using the Compiler Apps

If you are using one of the compiler apps, the required files discovered by the dependency analysis function are listed in the Files required by your application to run field.

To add files:

  1. Click the plus button in the field.

  2. Select the desired file from the file explorer.

  3. Click OK.

To remove files:

  1. Select the desired file.

  2. Press the Delete key.

    Caution   Removing files from the list of required files may cause your application to not compile or to not run properly when deployed.

Using mcc

If you are using mcc to compile your MATLAB code, the compiler does not display a list of required files before running. Instead, it compiles all of the required files that are discovered by the dependency analysis function and adds them to the generated binary file.

You can add files to the list by passing one, or more, -a arguments to mcc. The -a arguments add the specified files to the list of files to be added into the generated binary. For example, -a hello.m adds the file hello.m to the list of required files and -a ./foo adds all of the files in foo, and its subfolders, to the list of required files.

Was this topic helpful?