Index and Search Models with Model Finder
Use the Model Finder user
interface (UI) to search and browse examples, models, and projects across various databases.
Model Finder supports multiple databases, including the default MathWorks® Examples database. You can also create new databases or import any
existing databases to Model Finder. Using multiple databases enables you to group similar
models, making it simpler to share, search, maintain, and control access to these databases.
You can use Model Finder to index models in your databases and to store textual information of
models, such as model names, paths, blocks, and descriptions to make the models easily
searchable using Model Finder.
To support a collaborative development of models in your teams, use the Model Finder to:
Create or Import — Create a new database or use an existing database for your project.
Index — Store model-related textual data in a database to make models easily findable.
Share — Store database in a shared repository, such as a file server, cloud storage, or source code management (SCM) system for collaborative use by team members.
Reuse — Search the database to find relevant models across multiple databases.
Configure, Share, and Search Databases
Model Finder uses the default MathWorks Examples database consisting of MathWorks examples, models, and projects. You can also configure your databases with the
Model Finder.
MATLAB Code to Setup and Access a Shared Database
To setup a shared database of your team's collection of Simulink® models for a project related to Wireless Communication Systems follow these steps:
Create a project database — Create a dedicated database using Model Finder to store information of the Simulink models related to the project. To create a new database, use the
modelfinder.createDatabasefunction.For example, create a database
wireless_systems.dband assign aliasWireless Communication.modelfinder.createDatabase("simuink\modelfinderdatabases\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.
You can view the list of databases available in the Model Finder UI. Open the Model Finder UI by using the
modelfinderuifunction and view the list of databases in the Databases pane.
Index models in project database — Store textual information of the models, such as model names, model paths, descriptions, annotations, block names, block types, and referenced files in the database. To index models in a database, use the
modelfinder.registerFolderfunction.To index models from the folder named
5Ginwireless_systems.db, set the database as the database where the models will be indexed, and then register the folder that contains the models.modelfinder.setDatabaseToIndex("simulink\modelfinderdatabases\wireless_systems.db") modelfinder.registerFolder("simulink\data\5G")
Share database — Store the database file in a shared repository, such as a file server, cloud storage, or SCM system. Team members can access, search, and index models collaboratively in the same database.
To access the shared database, team members have to import the database to Model Finder. Importing the database allows them to search for models or index their models in the database.
To import the database to Model Finder:
Create a MATLAB function file named
sl_customization.m. In thesl_customization.mfile, specify the customization to import a database by using theModelFinderCustomizerclass function on the customization manager objectcm.To import the shared database
wireless_systems.dbfrom a shared repository and assign an aliasShared Database, specify this customization in the customization filesl_customization.m.function sl_customization(cm) dbPath = fullfile("simulink","modelfinderdatabases","wireless_systems.db"); cm.ModelFinderCustomizer.importDatabase(dbPath,“Shared Database”); end
Add the customization file to the MATLAB path or the current folder. For more information, see Register Customizations with Simulink. You can have more than one
sl_customization.mfile and the customizations in each file take effect.Alternatively, the team admin can create a
startup.mfile to automatically add the customization file to the MATLAB path for all team members. For more information, see Startup Options in MATLAB Startup File.Refresh customizations by using the
sl_refresh_customizationsfunction in the MATLAB Command Window. Simulink applies the specified customizations for the current session.Open the Model Finder UI by using the
modelfinderuifunction in the MATLAB Command Window. The shared database appears in the Databases pane of Model Finder UI, and team members can search for models in the database.
Alternatively, if the database file is shared directly and not stored in a shared
repository, team members can manually import the database into the settings folder by using
the modelfinder.importDatabase function and the path to the database file.
To import wireless_systems.db and assign alias Wireless
Communication, use this command in the MATLAB Command Window.
modelfinder.importDatabase("userB\modelfinderdatabases\wireless_systems.db","Wireless Communication")
Note
Model Finder supports only databases created in the same release version. To use databases from previous releases with the latest Model Finder, you must recreate them. This allows for optimal performance and access to the latest features of Model Finder.
After importing a database, you can perform these operations:
Search the database — Enter search terms in the Model Finder UI or use the
modelfinderfunction to initiate a search. Model Finder supports keyword-based searches and natural language queries. When you enter a search query, Model Finder returns a set of examples, models, and projects that match your search terms in the databases set as search databases. For more information, see Search, Filter, and Browse Models.Search for models in the search databases using the search term
mobile communication.modelfinder("mobile communication")Set database as search scope — By default, Model Finder includes the
MathWorks Examplesdatabase and any databases that are imported using a customization file within its search scope. To set a manually shared database as a search database, use themodelfinder.setDatabaseForSearchfunction.Set
wireless_systems.dbas the search database.modelfinder.setDatabaseForSearch("simulink\modelfinderdatabases\wireless_systems.db")Alternatively, you can change the search scope in the Model Finder UI. In the Databases pane, select the required database from the list of available databases.
Remove models from databases — If you do not want some models to appear in the search results of Model Finder, remove the folder that contains those models using the
modelfinder.unregisterFolderfunction.Remove indexed folder
5Gfrom the databases selected as search databases.modelfinder.unregisterFolder("simulink\data\5G")Remove databases from Model Finder — If you do not want to index or search models in certain databases, you can remove those databases from Model Finder. For more information on removing databases from Model Finder, see
modelfinder.deleteDatabase. Removing a database from Model Finder will not delete models or the database.Remove
wireless_systems.dbfrom Model Finder.modelfinder.deleteDatabase("simulink\modelfinderdatabases\wireless_systems.db")
Note
To view the changes in the Model Finder UI made using Model Finder functions, close and reopen the Model Finder UI.
See Also
Functions
modelfinder.createDatabase|modelfinder.importDatabase|modelfinder.setDatabaseToIndex|modelfinder.registerFolder|modelfinder.setDatabaseForSearch|modelfinder|modelfinder.deleteDatabase|modelfinder.unregisterFolder