Reshape Array function

From LabVIEW Wiki
Jump to: navigation, search
Reshape Array function
Object information
Owning palette(s) Array palette
Type Function
Requires Basic Development Environment
Icon Reshape Array.png

The Reshape Array function takes an array of any size and dimensionality and turns it into an array of different dimensionality using the original elements.

Usage

Connect an array of any size and dimensionality to n-dim array and extend the bottom border of the function until the desired number of output dimensions is reached. For each dimension specify the maximum number of elements. The resulting array contains exactly the desired number of elements.

Reshape Array - 2d to 1d.png Reshape Array - 1d to 2d.png

If the source contains more elements than desired, the array is cut off.

Reshape Array - Too many elements.png

If the source array contains less elements than desired, the array is padded with zeros.

Reshape Array - Too few elements.png

Best practice

  • If the input and output dimensionality is the same but with less elements, use Array Subset instead.
  • To swap the dimensionality of 2D arrays ([i:j] to [j:i]), use Transpose 2D Array instead.