Main Content

mlreportgen.finder.Finder class

Package: mlreportgen.finder

Create A MATLAB Finder


mlreportgen.finder.Finder is an abstract class of finder objects to find result objects that can be added to an object. Use this class as a basis for creating your own finder class.


expand all

Container to be searched by the finder. The data type depends on the type of container to be searched. For example, for a variable name, the data type is a character vector or string.

Properties of objects to find, specified as a cell array of name-value pairs. The finder returns only objects that have the specified properties with the specified values.

Example: finder.Properties = {'Gain','5'}


results = find(finder) finds items in the container specified by the finder. This method returns the items it finds wrapped in result objects. These results objects can be added directly to reports of type or You can also add the results to a reporter that you then add to a report.

tf = hasNext(finder) determines if the container that the finder searches contains at least one of the specified items to find. If the container has at least one item, the hasNext method queues that item as the next item that the next method will return. The hasNext method then returns true. Use the next method to obtain that item. On subsequent calls, the hasNext method determines if the container has an item that the next method has not yet retrieved. It queues the item for the next method to retrieve and returns true. If there are no more items to be retrieved, this method returns false. To search a container progressively for items, use the hasNext method with the next method in a while loop.

result = next(finder) returns the next search result in the result queue that the hasNext method created. This method returns the item that it finds, wrapped in an mlreportgen.finder.Result object. To add tables of the item properties, add the result object to the report directly or add it to a reporter that you then add to a report. The reports to which you can add the results of this method must be of type

tf = isIterating(finder) checks whether the finder is iterating to find results. If true, you cannot change any of the finder properties.

tf = mustNotBeIterating(finder) or tf = mustNotBeIterating(finder,propertyName) validates that the finder is not iterating to find results. If true, the finder must not be iterating and you can change property values, etc. If false, the finder is iterating and you cannot change its properties, etc. The optional propertyName input is the property that is being modified and caused the error.

tf = satisfyObjectPropertiesConstraint(finder,obj) determines if the obj has a property that satisfies the Properties constraint specified by the finder.

reset(finder) resets the finder to its initial state, such that calling next(finder) returns the first result and resets the object states.

Copy Semantics

Handle. To learn how handle classes affect copy operations, see Copying Objects.

Version History

Introduced in R2018a