This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

selectbyname (SimData)

Select data by name from SimData object array


[t,x,n] = selectbyname(simDataObj, 'NameValue')
Out = selectbyname(simDataObj, NameValue, 'Format', Format)


Output Arguments

tAn n-by-1 vector of time points.
xAn n-by-m data array. t and names label the rows and columns of x respectively.
nAn m-by-1 cell array of names.
OutData returned in the format as specified in 'FormatValue', shown in Input Arguments. Depending on the specified 'FormatValue', Out contains one of the following:
  • Structure array

  • SimData object

  • Time series object

  • Combined time series object from an array of SimData objects

Input Arguments

simDataObjSimData object array. Enter a variable name for a SimData object.
NameValueNames of the states for which you want to select data from simDataObj. Must be either a character vector or a cell array of character vectors.
QueryA cell array of arguments consisting of some combination of property name/property value pairs and/or 'Where' clauses. For a more complete description of the query syntax, including 'Where' clauses and their supported condition types, see sbioselect. You can use any of the metadata fields available in the cells of the DataInfo property of a SimData object. These include 'Type', 'Name', 'Units', 'Compartment' (species only), or 'Reaction' (parameter only).

Choose a format from the following table.

'num'Specifies the format that lets you return data in numeric arrays. This is the default when selectbyname is called with multiple output arguments.
'nummetadata'Specifies the format that lets you return a cell array of metadata structures in metadata instead of names. The elements of metadata label the columns of x.
'numqualnames'Specifies the format that lets you return qualified names in names to resolve ambiguities.
'struct'Specifies the format that lets you return a structure array holding both data and metadata. This is the default when you use a single output argument.
'simdata'Specifies the format that lets you return data in a new SimData object. This is the default format when selectbyname is called with zero or one output argument.
'ts'Specifies the format that lets you return data in time series objects, creating an individual time series for each state or column and SimData object in simDataObj.
'tslumped'Specifies the format that lets you return data in time series objects, combining data from each SimData object into a single time series.


The selectbyname method allows you to select data from a SimData object array by name. [t,x,n] = selectbyname(simDataObj, 'NameValue') returns time and state data from the SimData object simDataObj for states with names 'NameValue'.

In a SimData object simDataObj, the names labeling the columns of the data matrix simDataObj.Data are given by simDataObj.DataNames. A name specified in 'NameValue' can match more than one data column, for example, when simDataObj contains data for a species and parameter both named 'k'. To resolve ambiguities, use qualified names in 'NameValue', such as 'CompartmentName.SpeciesName' or 'ReactionName.ParameterName'. selectbyname returns qualified names in the output argument names when there are ambiguities.

Out = selectbyname(simDataObj, NameValue, 'Format', Format) returns the data in the specified format. Valid formats are listed in Input Arguments.


collapse all

This example uses the Lotka-Volterra (predator-prey) model described by Gillespie [1].

Load the sample project containing the Lotka-Volterra model m1.

sbioloadproject lotka;

Simulate the model m1.

sd = sbiosimulate(m1);

Plot the simulation results which show the states of all species in the model.


Select the simulation data of y1 and y2 species only.

sd2 = selectbyname(sd,{'y1','y2'});

Plot the selected data.


See Also

[1] Gillespie D.T. "Exact Stochatic Simulation of Coupled Chemical Reactions," (1977) The Journal of Physical Chemistry, 81(25), 2340-2361.

getdata, sbioselect, sbiosimulate

Was this topic helpful?