0% found this document useful (0 votes)
82 views

Array Exercise VI

This document provides instructions for building a LabVIEW VI that generates a random array of numbers, scales the array using a scaling factor, and takes a subset of the scaled array. The user is instructed to create front panel controls to input the scaling factor and subset parameters. In the block diagram, the user places functions to generate random numbers in a for loop to populate an array, multiply the array by the scaling factor, and select a subset of the scaled array defined by the start and number of elements controls. The completed VI is saved and can be run to generate different random number arrays based on the input control values.

Uploaded by

Sbo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
82 views

Array Exercise VI

This document provides instructions for building a LabVIEW VI that generates a random array of numbers, scales the array using a scaling factor, and takes a subset of the scaled array. The user is instructed to create front panel controls to input the scaling factor and subset parameters. In the block diagram, the user places functions to generate random numbers in a for loop to populate an array, multiply the array by the scaling factor, and select a subset of the scaled array defined by the start and number of elements controls. The completed VI is saved and can be run to generate different random number arrays based on the input control values.

Uploaded by

Sbo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Array Exercise VI

Complete the following steps to build a VI that creates an array of random numbers, scales
the resulting array, and takes a subset of that final array.

Front Panel

Open a blank VI and build the front panel shown in Figure.

Place an array, located on the Controls>>All Controls>>Array & Cluster


palette, on the front panel.
Label the array Random Array.
Place a numeric indicator, located on the Controls>>Numeric Indicators
palette, in the array shell.
Use the Positioning tool to resize the array control to contain 10
numeric indicators.
Press the <Ctrl> key while you click and drag the Random Array control to create
two copies of the control.
Label the copies Final Array and Subset Array.
Place three numeric controls, located on the Controls>>Numeric Controls
palette, and label them Scaling Factor, Start Subset, and # of Elements.
Right-click the Start Subset and # of Elements controls and select
Representation>>I32 from the shortcut menu.
Do not change the values of the front panel controls.
Block Diagram
Build the block diagram shown in Figure.

Place the Random Number (0-1) function, located on the


Functions>>Arithmetic & Comparison>>Express Numeric palette, on the
block diagram. This function generates a random number between 0 and 1
.

Place the For Loop, located on the Functions>>All


Functions>>Structures palette, on the block diagram. The loop accumulates an array
of 10 random numbers at the output tunnel. Create a constant of 10

1. for the count terminal.


2. Place the Multiply function, located on the Functions>>Arithmetic &
Comparison>>Express Numeric palette, on the block diagram. In this
exercise this function multiplies Random Array by Scaling Factor and
returns Final Array.

3. Place the Array Subset function, located on the Functions>>All


Functions>>Array palette, on the block diagram. This function returns a portion
of an array starting at Start Subset and containing # of Elements elements.

Save the VI as Array Exercise.vi in the C:\Exercises\ LabVIEW Basics


I directory.

Run the VI
Display the front panel, change the values of the controls, and run the VI a few times. The
For Loop runs for 10 iterations. Each iteration generates a random number and stores it at
the output tunnel. Random Array displays an array of 10
random numbers. The VI multiplies each value in Random Array by Scaling
Factor to create Final Array. The VI takes a subset of Final Array starting at
Start Subset for # of Elements and displays the subset in Subset Array.
Close the VI.

You might also like