Replacing Elements, Rows, Columns, and Pages within Arrays
- Updated2025-08-15
- 2 minute(s) read
You can replace an element, row, column, or page in an array. What you can replace depends on how many dimensions the array has. For example, in an array of two or more dimensions, you can replace a row or a column with a 1D array. In an array of three or more dimensions, you can replace a page with a 2D array.
Complete the following steps to replace elements, rows, columns, or pages in an array.
- Add the Replace Array Subset function to the block diagram.
- Wire an array of any dimension to the n-dimension array input of the Replace Array Subset function. The function automatically resizes based on the dimensions of the array.
- Determine which operation you want to perform from the following table and complete the associated steps.
Note The
index
input specifies which element, row, column, or page to replace, with 0 being the first. The
new element/subarray
input specifies the value you want to replace an element, or the array you want to replace a row, column, or page.
| Array wired to n-dimension array | Replacing | Complete these steps. |
|---|---|---|
| 1D array | Element | Wire a value 0- n to index. Wire a value to new element/subarray. |
| 2D array | Row | Wire a value 0- n to index (row). Wire a 1D array to new element/subarray. |
| Column | Wire a value 0- n to index (column). Wire a 1D array to new element/subarray. | |
| Element | Wire a value 0- n to index (row). Wire a value 0- n to index (column). Wire a value to new element/subarray. | |
| 3D- n D array | Page | Wire a value 0- n to index (page). Wire a 2D array to new element/subarray. |
| Row | Wire a value 0- n to index (page). Wire a value 0- n to index (row). Wire a 1D array to new element/subarray. | |
| Column | Wire a value 0- n to index (page). Wire a value 0- n to index (column). Wire a 1D array to new element/subarray. | |
| Element | Wire a value 0- n to index (page). Wire a value 0- n to index (row). Wire a value 0- n to index (column). Wire a value to new element/subarray. |
- Resize the Replace Array Subset function to replace another element, row, column, or page within an array and repeat steps 2 and 3.
- Run the VI.