dash.parse.switches

Parse inputs that are logical, numeric, or string switches


Syntax



Description

switches = dash.parse.switches(input, typeStrings, nSwitches)

Parses the states for a set of switches. Switch states are associated with collections of strings that indicate a particular state. As an alternative to strings, logical or numeric switch states may be used. Parses switch states for multiple switches. If the switch state is not scalar, requires a value for each switch.

= dash.parse.switches(…, name, listName, header)

Customize thrown error messages and identifiers.


Input Arguments

input

any data type
The input being parsed

typeStrings

cell vector [nStates] {string vector}
Strings corresponding to the possible states of the switch. A cell vector with one element per state. Each cell holds a string vector with strings that can be used to select the state.

nSwitches

scalar positive integer
The number of switch-states that are required.

name

string scalar
The name of the input

listName

string scalar
A name for the list of allowed strings

Output Arguments

switches

scalar | vector [nSwitches], logical | integers
The parsed switch states. States are logical when there are two states, or integers (from 0 to nStates-1) when there are more than two states. This output will either have a single element (same state for all switches) or one element per switch.