Multiport Selector
Distribute arbitrary subsets of input rows or columns to multiple output ports
Libraries:
DSP System Toolbox /
Signal Management /
Indexing
DSP System Toolbox HDL Support /
Signal Management
Description
The Multiport Selector block extracts multiple subsets of rows or columns from M-by-N input matrix u, and propagates each new submatrix to a distinct output port. For more details, see the description of the Select and Indices to output parameters.
Examples
Split Multichannel Signals into Individual Signals
Multichannel signals, represented by matrices in the Simulink® environment, are frequently used in signal processing models for efficiency and compactness. Though most of the signal processing blocks can process multichannel signals, you may need to access just one channel or a particular range of samples in a multichannel signal. You can access individual channels of the multichannel signal by using the blocks in the Indexing library. This library includes the Selector, Submatrix, Variable Selector, Multiport Selector, and Submatrix blocks.
You can split a multichannel based signal into single-channel signals using the Multiport Selector block. This block allows you to select specific rows and/or columns and propagate the selection to a chosen output port. In this example, a three-channel signal of size 3-by-1 is deconstructed into three independent signals of sample period 1 second.
Open the ex_splitmltichsbsigsind
model.
Double-click the Signal From Workspace block, and set the block parameters as follows:
Signal =
randn(3,1,10)
Sample time = 1
Samples per frame = 1
Based on these parameters, the Signal From Workspace block outputs a three-channel signal with a sample period of 1 second.
Save these parameters and close the dialog box by clicking OK.
Double-click the Multiport Selector block. Set the block parameters as follows, and then click OK:
Select =
Rows
Indices to output = {1,2,3}
Based on these parameters, the Multiport Selector block extracts the rows of the input. The Indices to output parameter setting specifies that row 1 of the input should be reproduced at output 1, row 2 of the input should be reproduced at output 2, and row 3 of the input should be reproduced at output 3.
Run the model.
At the MATLAB® command line, type dsp_examples_yout
. Because the input signal is random, your output might be different than the output shown here. This signal is the first row of the input to the Multiport Selector block. You can view the other two input rows by typing dsp_examples_yout1
and dsp_examples_yout2
, respectively.
dsp_examples_yout(:,:,1) = 0.8884 dsp_examples_yout(:,:,2) = -0.8095 dsp_examples_yout(:,:,3) = 0.3252 dsp_examples_yout(:,:,4) = -1.7115 dsp_examples_yout(:,:,5) = 0.3192 dsp_examples_yout(:,:,6) = -0.0301 dsp_examples_yout(:,:,7) = 1.0933 dsp_examples_yout(:,:,8) = 0.0774 dsp_examples_yout(:,:,9) = -0.0068 dsp_examples_yout(:,:,10) = 0.3714 dsp_examples_yout(:,:,11) = 0
You have now successfully created three single-channel signals from a multichannel signal using a Multiport Selector block.
Ports
Input
Input — Input
vector | matrix
Specify the input u as a vector or a matrix of size M-by-N. The block treats an unoriented length-M vector input as an M-by-1 matrix.
Data Types: single
| double
| int8
| int16
| int32
| uint8
| uint16
| uint32
| Boolean
| fixed point
| enumerated
Output
Output(s) — Row- or column-subsets of input
vector | matrix
Row- or column-subsets of input, propagated to each output port. Each cell in the Indices to output array determines the subset of input rows or columns to be propagated to the respective output port. The total number of cells in the Indices to output array determines the number of output ports on the block.
Data Types: single
| double
| int8
| int16
| int32
| uint8
| uint16
| uint32
| Boolean
| fixed point
| enumerated
Parameters
Select — Select input dimension
Rows
(default) | Columns
Select the input dimension as:
Rows
–– The block uses the one-dimensional indices you specify to select matrix rows, and all elements on the chosen rows are included.Columns
–– The block uses the one-dimensional indices you specify to select matrix columns, and all elements on the chosen columns are included.
A given input row or column can appear any number of times in any of the outputs, or not at all.
When an index references a nonexistent row or column of the input, the block reacts with the action you specify using the Invalid index parameter.
Indices to output — Indices to output
{ 4, [1:2 5], [7; 8], 10:-1:6 }
(default) | cell array
Specify the row- or column-subsets to propagate to each of the output ports as a cell array. The kth cell contains a one-dimensional indexing expression specifying the subset of input rows or columns to be propagated to the kth output port. The total number of cells in the array determines the number of output ports on the block.
Consider the following Indices to output cell array. This is a four-cell array which requires the block to generate four independent outputs (each at a distinct port).
{4,[1:2 5],[7;8],10:-1:6}
The following table shows the dimensions of these outputs when
Select = Rows
and the
input dimension is M-by-N.
Cell | Expression | Description | Output Size |
---|---|---|---|
1 |
| Row 4 of input | 1-by-N |
2 |
| Rows 1, 2, and 5 of input | 3-by-N |
3 |
| Rows 7 and 8 of input | 2-by-N |
4 |
| Rows 10, 9, 8, 7, and 6 of input | 5-by-N |
Invalid index — Action to take for invalid index
Clip Index
(default) | Clip and Warn
| Generate Error
Specify the action to take when there is an invalid index value. You can select one of the following options:
Clip index
— The block clips the index to the nearest valid value, and does not issue an alert.For example, if the block receives a
64
-by-4
input and the Select parameter is set toRows
, the block clips an index of72
to64
. For the same input, if the Select parameter is set toColumns
, the block clips an index of72
to4
. In both cases, the block clips an index of-2
to1
.Clip and warn
— The block clips the index to the nearest valid value and displays a warning message at the MATLAB® command line.Generate error
— The block displays an error dialog box and terminates the simulation.
Block Characteristics
Data Types |
|
Direct Feedthrough |
|
Multidimensional Signals |
|
Variable-Size Signals |
|
Zero-Crossing Detection |
|
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
Generated code relies on the memcpy
or
memset
function (string.h
) under certain
conditions.
HDL Code Generation
Generate VHDL, Verilog and SystemVerilog code for FPGA and ASIC designs using HDL Coder™.
HDL Coder™ provides additional configuration options that affect HDL implementation and synthesized logic.
This block has one default HDL architecture.
ConstrainedOutputPipeline | Number of registers to place at
the outputs by moving existing delays within your design. Distributed
pipelining does not redistribute these registers. The default is
|
InputPipeline | Number of input pipeline stages
to insert in the generated code. Distributed pipelining and constrained
output pipelining can move these registers. The default is
|
OutputPipeline | Number of output pipeline stages
to insert in the generated code. Distributed pipelining and constrained
output pipelining can move these registers. The default is
|
This block supports code generation for complex signals.
Version History
Introduced before R2006a
See Also
Permute Matrix (Simulink) | Selector (Simulink) | Submatrix (Simulink) | Variable Selector
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)