Demultiplexer Select by Mask navigation bar

Table of Contents

Replace Elements

Replaces selected elements of the first input with the elements of the second input.

Library

QUARC Targets/Signal Routing

Description

Replace Elements

The Replace Elements block allows elements of the first input to be replaced with the elements of the second input. Since the indices of the elements to be replaced can be dynamic, the Replace Elements block is more flexible than using Mux or Demux blocks.

The Replace Elements block differs from the Assignment block in that it always modifies the current input rather than building up a signal based on an initial value.

Input Ports

u

The signal to be modified.

r

The signal containing the replacement values.

Output Ports

y

The input signal, u, with the elements from r substituted at the specified indices.

i<n>

An index vector containing the indices for one dimension of the input signal u at which to replace the elements. The value of <n> will match the dimension to which the index vector corresponds.

Inputs of this form are only present when the Index vector (port) index option is selected for a dimension in the parameters.

s<n>

A scalar starting index containing the index for one dimension of the input signal u at which to start replacing the elements. The value of <n> will match the dimension to which the starting index corresponds.

Inputs of this form are only present when the Starting index (port) index option is selected for a dimension in the parameters.

Data Type Support

The Replace Elements block supports any data type except fixed point, including complex, multidimensional and variable size signals, at the u and r ports. The i<n>n and s<n>n inputs may be any of the standard Simulink built-in numeric data types other than boolean.

Parameters and Dialog Box

Replace Elements

Number of dimensions

The number of dimensions of the input signal. This parameter determines the size of the table.

Indexing mode

Whether to treat the indices as zero-based or one-based indices. The indexing mode applies to indices in the dialog or at input ports.

Index options

The index options determine how the index for a particular dimension of the input signal will be determined. The following table describes each of the indexing options:

Index Option

Description

Assign All

The index corresponds to the entire dimension. This option is equivalent to 1:N where N is the size of that dimension.

Index vector (dialog)

The vector specified in the Index column determines the indices of this dimension at which to replace the input signal elements. Note that the indices need not be contiguous or in order.

Index vector (port)

The vector supplied at the corresponding i<n> port determines the indices of this dimension at which to replace the input signal elements. Note that the indices need not be contiguous or in order.

Starting index (dialog)

The scalar specified in the Index column determines the index of this dimension at which to start replacing the input signal elements. The size of the corresponding dimension of the r input will determine how many elements in this dimension will be replaced.

Starting index (port)

The scalar supplied at the corresponding s<n> port determines the index of this dimension at which to start replacing the input signal elements. The size of the corresponding dimension of the r input will determine how many elements in this dimension will be replaced.

Index

The purpose of this column in the table depends on the Index option selected in the first column. The following table outlines the purpose of the second column based on the index option selected in the first column:

Index Option

Index Description

Assign All

The Index column is ignored in this case.

Index vector (dialog)

The vector specified in the Index column determines the indices of this dimension at which to replace the input signal elements. Note that the indices need not be contiguous or in order.

Index vector (port)

The Index column is ignored in this case.

Starting index (dialog)

The Index must be a scalar. The value determines the index of this dimension at which to start replacing the input signal elements. The size of the corresponding dimension of the r input will determine how many elements in this dimension will be replaced.

Starting index (port)

The Index column is ignored in this case.

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