Reshape Array
- Updated2025-07-30
- 3 minute(s) read
Changes the dimensions of an array according to the values of dimension size 0..m-1.
This function reads the array data in memory from left to right, row by row and populates the reshaped array the same way. For example, if you pass a 2D array of 8 elements, 2 columns of {0,1,2, 3}, to this function with two dimensions defined with sizes of 2 and 4, respectively, the function returns an array containing {{0,0,1,1}, {2,2, 3, 3}}. The connector pane displays the default data types for this polymorphic function.

Inputs/Outputs
array
—
n-dim array can be an n-dimensional array of any type.
dimension size
—
dimension size 0..m-1 specifies the dimensions of m-dim array and must be a numeric. The function creates an empty array if any dimension size is 0. You must have m dimension size terminals for m-dimensions.
output array
—
m-dim array If the product of the dimension sizes is greater than the number of elements in the input array, the function pads the new array with the default of the data type of n-dim array. If the product of the dimension sizes is less than the number of elements in the input array, the function truncates the array. |
This function adjusts the array data in memory according to the reshaped array dimensions. This function pads or truncates the data if necessary. For example, if you pass a 1D array with 9 elements {0, 1, 2, 3, 4, 5, 6, 7, 8} to this function with two dimensions defined with sizes of 2 and 3, respectively, the function returns a 2D array containing {{0, 1, 2}, {3, 4, 5}}. The function truncates the last three input elements because the output array has room for only six values.
Resize this function to increase the number of dimension size parameters. m-dim array has one dimension for each dimension size input. For example, you can use this function to change a 1D array into a 2D array or vice versa. You also can use it to increase and decrease the size of a 1D array.
FPGA Module Details
The following details apply when you use this object in an FPGA VI.
| Single-Cycle Timed Loop | Supported. |
| Usage | The LabVIEW FPGA Module supports only one-dimensional arrays that resolve to a single size at compile time. The dimension size input must be constant so that LabVIEW can determine the size of the output array. You can either wire constant values directly to this function, or rely on value propagation through constant folding. |
| Timing | This function requires no clock cycles to execute because it does not include an internal register. |
| Resources | This function consumes no FPGA resources because it is purely a wiring operation. |
array
—
dimension size
—
output array
—