Table of Contents
Replace Elements
Replaces selected elements of the first input with the elements of the second input.
Library
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
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
MATLAB Command Line
Click to copy the following command line to the clipboard. Then paste it in the MATLAB Command Window:
doc('Mux');MATLAB Command Line
Click to copy the following command line to the clipboard. Then paste it in the MATLAB Command Window:
doc('Demux');The Replace Elements block differs from the
MATLAB Command Line
Click to copy the following command line to the clipboard. Then paste it in the MATLAB Command Window:
doc('Assignment');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 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
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
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 |
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 |
---|---|---|---|
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
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 |
See Also
Copyright ©2024 Quanser Inc. This page was generated 2024-10-17. Submit feedback to Quanser about this page.
Link to this page.