dash.assert.strsInList
Throw error if strings are not in a list of allowed strings
Syntax
Description
Checks if all elements in strings are members of list. If not, throws an error. If so, returns the indices of each string in the list.
Use custom names for the strings and list in the thrown error message.
Use a custom header in thrown error IDs.
Input Arguments
strings
string vector [nStrings]
The set of strings being checked
list
string vector
The set of allowed strings
name
string scalar
The name of strings in the calling function. Default is “strings”
listName
string scalar
The name of list in the calling function. Default is “value in the list”
idHeader
string scalar
A header for thrown error IDs. Default is “DASH:assert:strsInList”
Output Arguments
k
vector, linear indices [nStrings]
The index of each element of strings in the list of allowed values