Example Code

Bidirectional Rotation of a 2D Array by a Multiple of 90 Degrees

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

 

Overview

Coding that exemplifies how to rotate a 2D array.

 

Description

This subVI utilizes the Transpose 2D Array.vi and the Reverse 1D Array.vi (with an auto-indexed for loop) to rotate a 2D array clockwise or counterclockwise respectively.

 

Requirements

LabVIEW 2012 (or compatible)

 

Steps to Implement or Execute Code
1. Enter the desired input array into the Array control, or use the default values.
2. Select the direction on the Rotation Orientation toggle and the magnitude on the Rotation enum.
3. Run the VI and observe the rotation.

 

Additional Information or References

 

Front Panel:

Screenshot_1.png

Block Diagram:

 

Clockwise:

Snippet.png

Counterclockwise:

Snippet 2.png

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.