find
Get element or collection of elements from dataset
Syntax
Description
[
returns
a datasetOut
,retIndex
]=find(datasetIn
,Name
,Value
,…)Simulink.SimulationData.Dataset
object and indices
of the elements whose property values match the specified property
names and values. Specify optional comma-separated pairs of Name,Value
properties. Name
is
the property name and Value
is the corresponding
value. Name
must appear inside single quotes ('
'
). You can specify several name-value pair properties in
any order as Name1,Value1,...,NameN,ValueN
.
[
matches
elements using regular expressions as if the value of the property
is passed to the datasetOut
,retIndex
]=find(datasetIn
,'-regexp',Name
,Value
,…)regexp
function as:
regexp(element.Name,Value)
-regexp
. If there is no -regexp
,
the method matches elements as if the value of the property is passed
as:isequal(element.Name,Value)
For more information on -regexp
, see -regexp With Multiple Block Paths.
-regexp
With Multiple Block Paths
-regexp
works with properties of type char.
To specify multiple block paths, you can use Simulink.SimulationData.BlockPath
and Simulink.BlockPath
.
For example, when a signal is logged in a referenced model, you can
use Simulink.SimulationData.BlockPath
to specify
multiple block paths.
The method returns elements that contain a BlockPath property
where one or more of the individual block paths match the specified Value
path
when you use:
-regexp
with the BlockPathName
property.Value
as a character vector or scalar object of typeSimulink.SimulationData.BlockPath
with one block path
Input Arguments
Output Arguments
Examples
Alternative
You can use curly braces to streamline indexing syntax to get
an element in a dataset, instead of using find
.
The index must be a scalar that is not greater than the number of
elements in the variable. For example, get the second element of the logsout
dataset.
logsout{2}
Also, you can use the get
method to get an
element or collection of elements from a dataset.
Version History
Introduced in R2015b
See Also
Simulink.SimulationData.DatasetRef.getDatasetVariableNames
| Simulink.SimulationData.BlockPath
| Simulink.SimulationData.Signal
| Simulink.SimulationData.DataStoreMemory
| addElement
| concat
| get
| getElementNames
| numElements
| setElement
| Simulink.SimulationData.Dataset
| regexp
| findobj