Main Content

Create a Custom Task Function

In a project, you can create functions and run them on selected project files.

For example custom task functions, see Run Custom Tasks with a Project.

To create a custom task function:

  1. On the Project tab, click the down arrow to expand the Tools gallery. Under Project Checks, click Custom Tasks. In the Custom Task dialog box, click Manage.

  2. In the Manage Custom Tasks dialog box, select Add > Add Using New Function or Add Using Existing Function.

    Either browse to an existing script, or name and save the new file on your MATLAB® path. The file is added to the project.

  3. The MATLAB Editor opens the new file containing a simple example custom task function for you to edit. Edit the function to perform the desired action on each file. The instructions guide you to create a custom task with the correct function signature. Save the file.

  4. To run your task, on the Project tab, click the down arrow to expand the Tools gallery. Under Project Checks, click Custom Tasks. In the Custom Task dialog box, select project files to include using the check boxes, select your custom task in the list, and click Run Task.

  5. After your custom task function runs, view the results in the Custom Task Report.

  6. To save the results in a file, click Publish Report.

Related Topics