Main Content

padv.builtin.task.IndexModels Class

Namespace: padv.builtin.task
Superclasses: padv.Task

Task for indexing models in database

Since R2025a

Description

The padv.builtin.task.IndexModels class provides a task in Process Advisor that indexes Simulink® models in a database. By indexing models in a database, you can store the textual information pertaining to the models such as model names, model paths, descriptions, annotations, block names, and block types. After indexing, you can set a search query in the database to access the models by using the Model Finder user interface (UI). Model Finder matches your search query with the stored information in the database and displays the search results. You can then filter and browse these search results by using the Model Finder UI.

You can add the IndexModels task to your process model by using the addTask function. After adding the task to your process model, you can run the task from the Process Advisor app or by using the runprocess function. When Process Advisor runs the IndexModels task, Model Finder indexes all models associated with your project in its default database projectModels.db. You can also use custom databases for indexing models.

To view the source code for this built-in task, in the MATLAB® Command Window, enter:

open padv.builtin.task.IndexModels

The padv.builtin.task.IndexModels class is a handle class.

Creation

Description

task = padv.builtin.task.IndexModels creates a task to index models.

example

Properties

expand all

Default database file used for indexing models, returned as a string.

Attributes:

GetAccess
public
Constant
true
NonCopyable
true

Folder path located within the MATLAB preferences folder that contains the default database file projectModels.dB used for indexing models, returned as a string.

Attributes:

GetAccess
public
Constant
true
NonCopyable
true

Alternative name of the default database that displays the database in the Model Finder UI, returned as a string.

Attributes:

GetAccess
public
Constant
true
NonCopyable
true

The IndexModels class inherits properties from the padv.Task class. The properties listed in Specialized Inherited Properties are padv.Task properties that the IndexModels class overrides.

Specialized Inherited Properties

Unique identifier for the task in process, returned as "padv.builtin.task.IndexModels".

Attributes:

GetAccess
public
SetAccess
immutable

Human-readable name that appears in the Process Advisor app, specified as a string.

Example: "Index Models Task"

Attributes:

GetAccess
public
SetAccess
public

Data Types: string

Task description, specified as a string.

When you point to a task in Process Advisor and click the information icon, the tooltip shows the task description.

Example: "This task indexes models in a database using Model Finder."

Attributes:

GetAccess
public
SetAccess
public

Data Types: string

Path to task documentation, specified as a string.

When you point to a task in Process Advisor, click the ellipsis (...), and then click Help, Process Advisor opens the task documentation.

Example: fullfile(pwd,"taskHelpFiles","myTaskDocumentation.pdf")

Attributes:

GetAccess
public
SetAccess
public
Dependent
gf

Data Types: string

Query that finds the artifacts that the task iterates over, specified as a padv.Query object or the name of a padv.Query object. When you specify IterationQuery, the task runs one time for each artifact returned by the query. In the Process Advisor app, the artifacts returned by IterationQuery appear under task title.

For more information about task iterations, see Overview of Process Model.

Example: padv.builtin.query.FindModels

Attributes:

GetAccess
public
SetAccess
public

Function that launches a tool, specified as the function handle.

When you point to a task in the Process Advisor app, you can click the ellipsis (...) to see more options. For built-in tasks, you have the option to launch a tool associated with the task.

For the task IndexModels, you can launch the Model Finder UI.

Attributes:

GetAccess
public
SetAccess
public

Data Types: function_handle

Description of the action that the LaunchToolAction property performs, specified as a string.

Attributes:

GetAccess
public
SetAccess
public

Data Types: string

Inputs to the task, specified as:

  • a padv.Query object

  • the name of padv.Query object

  • an array of padv.Query objects

  • an array of names of padv.Query objects

By default, the IndexModels task does not have inputs and indexes the models in the default database. When you specify InputQueries, the task uses the artifacts returned by the specified query or queries as inputs. For example, to index models in a custom database, you can specify InputQueries as the built-in query padv.builtin.query.FindFileWithAddress, to find the database file for indexing models.

For more information, see Overview of Process Model and Find Artifacts with Queries.

Example: InputQueries=padv.builtin.query.FindFileWithAddress(Type="mf_database",Path="\home\users\projects\wireless\wireless_systems.db")

Attributes:

GetAccess
public
SetAccess
public

Methods

expand all

Public Methods

Examples

collapse all

Add a task to index models in the default database projectModels.db. This database file is located in the "\mw_resources_mw\mf_db\" folder within the MATLAB preferences folder.

1. Open the Process Advisor example project.

processAdvisorExampleStart

2. To edit the process model for the project, click the Edit process model button in the Process Advisor toolstrip.

The processmodel function opens. processmodel takes a padv.ProcessModel object as an input argument.

function processmodel(pm)
    arguments
        pm padv.ProcessModel
    end
end

3. Add the built-in IndexModels task in processmodel by using the addTask method of the padv.ProcessModel object pm.

indexModelsTask = pm.addTask(padv.builtin.task.IndexModels);

When the Process Advisor runs the IndexModels task, Model Finder indexes all models associated with your project in the default database projectModels.db. By indexing models, the database stores the textual information of the models such as model names, model paths, descriptions, annotations, block names, and block types. You can access these models by searching the database by using the Model Finder UI.

To open the Model Finder UI, use the modelfinderui function in the MATLAB Command Window. In the Model Finder UI, you can view the Project Models database in the Databases pane and search for models indexed in the database. For information on how to search using the Model Finder UI, see Search, Filter, and Browse Models.

Add a task to index models in a custom database file. By default all models and project files are indexed in the default database projectModels.db. You can also configure custom databases and use them to index project specific models.

1. Open the Process Advisor example project.

processAdvisorExampleStart

2. To index models in a custom database, you can either use an existing database or create a new database.

Create a new database. Use the modelfinder.createDatabase function to create a database wireless_systems.db and assign the alias Wireless Communication. Specify the absolute or relative path to the database file.

modelfinder.createDatabase("\home\users\projects\wireless\wireless_systems.db", ...
                  "Wireless Communication")

Model Finder uses the alias to display the database in the Model Finder UI. If you do not specify an alias, Model Finder uses the database filename as the alias.

Alternatively, to use an existing database, import the database to Model Finder by using the modelfinder.importDatabase function. For example, use this command to import a database wireless_systems.db and assign an alias Wireless Communication. Specify the absolute or relative path to the database file you want to import.

modelfinder.importDatabase("\home\users\projects\wireless\wireless_systems.db", ...
            "Wireless Communication")

3. To edit the process model for the project, click the Edit process model button in the Process Advisor toolstrip.

The processmodel function opens. processmodel takes a padv.ProcessModel object as an input argument.

function processmodel(pm)
    arguments
        pm padv.ProcessModel
    end
end

3. Add the built-in IndexModels task in processmodel by using the addTask method on the padv.ProcessModel object pm.

indexModelsTask = pm.addTask(padv.builtin.task.IndexModels);

4. Reconfigure the task to specify a custom database to index models by using the padv.builtin.query.FindFileWithAddress query.

indexModelsTask.addInputQueries(padv.builtin.query.FindFileWithAddress( ...
                    Type="mf_database", ...
                    Path="\home\users\projects\wireless\wireless_systems.db"));

For the FindFileWithAddress query:

  • The first argument, "mf_database", specifies that the file is a Model Finder database file.

  • The second argument specifies the path to the database file.

When the Process Advisor runs the IndexModels task, Model Finder indexes all models associated with your project in the custom database. You can access these models by searching the database by using the Model Finder UI.

To open the Model Finder UI, use the modelfinderui function in the MATLAB Command Window. In the Model Finder UI, you can view the custom database Wireless Communication in the Databases pane and search for models indexed in the database. For information on how to search using the Model Finder UI, see Search, Filter, and Browse Models.

Version History

Introduced in R2025a