Selector Block
Selects one of multiple input signals based on an index. The index input determines which input is routed to the output.
Open Selector in BlockWerk →# Selector
Description
Selects one of multiple input signals based on an index value.
Mathematical Model
y(t) = u_{\text{index}}(t)
Parameters
| Parameter | Type | Default | Description | | --------- | ------ | ------- | ----------------------------------- | | numInputs | number | 2 | Number of data inputs (2-10) | | indexBase | select | 1 | Whether index is 0-based or 1-based |
numInputs
Type: number (Default: 2)
Number of Inputs parameter description placeholder.
indexBase
Type: select (Default: "1")
Index Base parameter description placeholder.
Ports
- Idx (input): Index selecting which input to route (clamped to valid range)
- In1, In2, ... (inputs): Data input signals
- Out (output): The selected input signal
Behaviour
- The
idxinput selects which data input is routed to the output - With
indexBase = 1: idx=1 selects in1, idx=2 selects in2, etc. - With
indexBase = 0: idx=0 selects in1, idx=1 selects in2, etc. - The index is rounded to the nearest integer and clamped to the valid range
- If no matching input is found, outputs 0.0
Remarks
- Index clamping: The index input is rounded to the nearest integer and clamped to [1, numInputs] (or [0, numInputs-1] in 0-based mode); out-of-range indices always produce a valid output
- 0-based vs 1-based: Use
indexBase = 0when the index comes from another block that outputs zero-based indices (e.g., a counter starting at 0) - Dynamic selection: The index can be a time-varying signal, allowing the selector to dynamically switch between inputs during simulation
- Unconnected inputs: If a selected data input is not connected, the output is 0.0
- Performance: Minimal overhead — index clamping and selection happen in a single step
Examples
- Zie de ingebouwde voorbeelden in de handleiding voor een demonstratie van dit blok.
See Also
- Constant: Eenvoudige signaalbron