getIndex

Class: SimBiology.export.Model

Get indices into ValueInfo and InitialValues properties

Syntax

indices = getIndex(model,name)
indices = getIndex(model,name,type)

Description

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.

Input Arguments

model

SimBiology.export.Model object.

name

Character vector containing a name to match against the QualifiedName, then Name, properties of the ValueInfo objects in model.

type

Character vector containing a name to match against the Type property of the ValueInfo objects in model.

Default: All types.

Output Arguments

indices

Vector of indices indicating which ValueInfo objects in a SimBiology.export.Model object match on the specified name and type.

Examples

expand all

Load a sample SimBiology model object, 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.

em.ValueInfo(ix).Type
ans =

species

The name y1 corresponds to an editable species.