dash.parse.stringsOrIndices
Parse inputs that are either a list of strings, or a vector of indices
Syntax
Description
Parses an input that may either be a list of strings referencing elements in a collection, or a vector of indices for elements in the collection. Throws an error if the input not a valid reference to a collection. If the input is valid, returns the linear indices of the elements of the input within the collection.
indices = dash.parse.stringsOrIndices(input, strings, name, elementName, collectionName, listType, header)
Customized error messages and IDs.
Input Arguments
input
any data type
The input being parsed.
strings
string vector [nElements]
The list of strings associated with elements in a collection.
name
string scalar
The name of the input being parsed. Default is “input”
elementName
string scalar
A name for a singular element in the collection. Default is “element”.
collectionName
string scalar
A name for the collection. Default is “the collection”
listType
string scalar
A name for the type of list required when the input is a string list. Default is “elements in the collection”.
header
string scalar
Header for thrown error IDs. Default is “DASH:parse:stringsOrIndices”.
Output Arguments
indices
vector, linear indices
The linear indices of the input elements within the collection.