Replace Elements End of trail navigation bar

Table of Contents

Select by Mask

Selects elements from the input signal based on a mask.

Library

QUARC Targets/Signal Routing

MATLAB Command Line

Click to copy the following command line to the clipboard. Then paste it in the MATLAB Command Window:

qc_open_library('quarc_library/Signal Routing')

Description

Select by Mask

The Select by Mask block allows elements of the first input to be extracted to form the output based on a mask. The mask may come from a dialog parameter or from a second input. For each non-zero element of the mask the corresponding element of the input vector is selected. For each zero element of the mask, the corresponding element of the input vector is not included in the output.

The inputs and output may be fixed or variable-size signals. If the output is fixed-size then the block also outputs the number of valid elements. If the output is variable-size, then the number of elements in the output will equal the number of non-zero elements in the mask vector.

The Select by Mask block differs from the

Selector

MATLAB Command Line

Click to copy the following command line to the clipboard. Then paste it in the MATLAB Command Window:

doc('Selector');
block in that it uses a mask vector to select the output elements rather than indices.

Input Ports

u

The signal from which elements are selected.

mask

The signal containing the mask values. This input is only present when the Source of mask option is set to Input port.

Output Ports

y

A vector of the elements selected from the the input signal, u. For a fixed-size output, the remaining elements are set to zero.

#

A uint32 value indicating the number of selected elements in the output . This output is only present if the Use variable-size output option is not checked.

Data Type Support

The Select by Mask block supports any data type except fixed point, including complex and variable size signals, at the u port. The mask port accepts any of the standard Simulink built-in numeric data types, and may be variable-size.

Parameters and Dialog Box

Select by Mask

Source of mask

The source of the mask vector: either an input port or a dialog parameter.

Mask (tunable online)

The mask vector used to select the inputs when the Source of mask parameter is set to Specify via dialog.

Use variable-size output

Enabling this option causes the y output to be variable-size. If this option is not checked then the output is a fixed-size vector and there will be a second output, # , indicating the number of selected elements. See Variable-Size Signals for more information on variable-size signals.

Targets

Target Name

Compatible*

Model Referencing

Comments

QUARC Win32 Target

Yes

Yes

QUARC Win64 Target

Yes

Yes

QUARC Linux Nvidia Target

Yes

Yes

QUARC Linux QBot Platform Target

Yes

Yes

QUARC Linux QCar 2 Target

Yes

Yes

QUARC Linux QDrone 2 Target

Yes

Yes

QUARC Linux Raspberry Pi 3 Target

Yes

Yes

QUARC Linux Raspberry Pi 4 Target

Yes

Yes

QUARC Linux RT ARMv7 Target

Yes

Yes

QUARC Linux x64 Target

Yes

Yes

QUARC Linux DuoVero Target

Yes

Yes

QUARC Linux DuoVero 2016 Target

Yes

Yes

QUARC Linux Verdex Target

Yes

Yes

QUARC QNX x86 Target

Yes

Yes

Last fully supported in QUARC 2018.

Rapid Simulation (RSIM) Target

Yes

Yes

S-Function Target

No

N/A

Old technology. Use model referencing instead.

Normal simulation

Yes

Yes

* Compatible means that the block can be compiled for the target.

See Also

 

navigation bar