Main Content

getIndex

Get indices into ValueInfo and InitialValues properties

Description

example

indices = getIndex(model,name) returns the indices of all ValueInfo objects in a SimBiology.export.Model object that have a QualifiedName or Name property that match the specified name input argument.

  • getIndex first tries to match the QualifiedName property. If there are matches, then getIndex returns their indices.

  • If there are no matches based on QualifiedName, then getIndex tries to match the Name property. If there are matches, then getIndex returns their indices.

  • If there are no matches based on QualifiedName or Name, then getIndex returns [].

indices = getIndex(model,name,type) returns indices for only the ValueInfo objects with a Type property that matches the type input argument.

Examples

collapse all

Load a sample SimBiology model (lotka), and export.

modelObj = sbmlimport('lotka');
em = export(modelObj);

Get the index of the editable value with name y1.

ix = getIndex(em,'y1')
ix = 3

Display the type of value. The name y1 corresponds to an editable species.

em.ValueInfo(ix).Type
ans = 
'species'

Input Arguments

collapse all

Input model, specified as a SimBiology.export.Model object.

Name of a species, compartment, or parameter, specified as a character vector or string scalar. The name input must contain a name to match against the QualifiedName, then Name properties of the ValueInfo objects in model.

Type of value, specified as "species", "compartment", or "parameter", to match against the Type property of the ValueInfo objects in model. If you do not specify type, then getIndex returns the indices for all three types.

Output Arguments

collapse all

Matching indices, returned as a vector of integers indicating which ValueInfo objects in a SimBiology.export.Model object match on the specified name and type.

Version History

Introduced in R2012b