0% found this document useful (0 votes)
41 views6 pages

Proiect 6. Manipulating Arrays

This document provides instructions for completing an array manipulation VI in LabVIEW. It describes 6 cases to implement using a tab control: 1) concatenating channels, 2) adding/subtracting channels, 3) selecting a channel, 4) working with waveform data, 5) accessing all data channels, and 6) extracting a waveform subset. For each case, functions like Build Array, Index Array, and Array Subset are used to manipulate and process the array data in different ways like combining waveforms, selecting elements, and zooming in on subsets. The completed VI allows testing various techniques for manipulating arrays through interactive controls and indicators on the front panel.

Uploaded by

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

Proiect 6. Manipulating Arrays

This document provides instructions for completing an array manipulation VI in LabVIEW. It describes 6 cases to implement using a tab control: 1) concatenating channels, 2) adding/subtracting channels, 3) selecting a channel, 4) working with waveform data, 5) accessing all data channels, and 6) extracting a waveform subset. For each case, functions like Build Array, Index Array, and Array Subset are used to manipulate and process the array data in different ways like combining waveforms, selecting elements, and zooming in on subsets. The completed VI allows testing various techniques for manipulating arrays through interactive controls and indicators on the front panel.

Uploaded by

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

Proiect 6.

Manipulating Arrays
Goal
Manipulate arrays using various LabVIEW functions.
Description
You are given a VI and asked to enhance it for a variety of purposes. The front panel of this VI is built.
You complete the block diagram to practice several different techniques to manipulate arrays.
Implementation
1. Se implementează PF din Fig.6-1. Se va utiliza un Tab Control cu 6 Pagini
You can use Tab Control pentru a suprapune controalele si indicatoarele din PF într-o zonă mai mică. A
tab control consists of pages and tabs. Add front panel objects to the pages of the tab control and use the
tab as the selector to display each page.
Add any front panel objects to the active page. A page is active when the tab for that page is flush with the
page and the objects on the page are visible. Terminals for controls and indicators you add to the tab
control appear as any other block diagram terminal.

Figure 6-1. Array Manipulation VI Front Panel

2. Open the block diagram and complete each of the cases that correspond to the tabs on the front panel as
shown in Figures 6-2 through 6-8.
Figure 6-2. Array Manipulation VI—Concatenate Channels Case

1 Build Array—Expand this node to accept two inputs, and then right-click and select Concatenate
inputs from the shortcut menu.
2 Wire the sine wave and square wave outputs to the Build Array function to create a 1D array with both
waveforms.
3. Switch to the front panel and test the Concatenate Channels case.
On the front panel, click the Concatenate Channels tab.
Run the VI and notice that the sine wave is concatenated with a square wave.
4. Stop the VI.
5. Switch to the block diagram and select the Add/Subtract Channels case.
6. Complete the Add/Subtract Channels case as shown in Figure 6-3 and Figure 6-4.

Figure 5-3. Array Manipulation VI—Add/Subtract Channels True Case

1 Subtract?—Wire this to the case selector terminal so that the correct case executes when you click the
Subtract? button on the front panel.
2 Case Structure—Place a Subtract function in the True case, so that the VI subtracts the elements of the
array when the Subtract? button on the front panel is pressed.
Figure 6-4. Array Manipulation VI—Add/Subtract Channels False Case

1 When the value of the Subtract? Boolean control is False, the array elements are added.
Note This case demonstrates polymorphic functionality by adding and subtracting elements of the array.
7. Switch to the front panel and test the Add/Subtract Channels case.
On the front panel, click the Add/Subtract Channels tab.
Run the VI.
Click the Subtract? button and observe the behavior of subtracting the square wave from the sine
wave.
8. Stop the VI.
9. Switch to the block diagram and select the Select a Channel case.
10. Complete the Select a Channel case as shown in Figure 6-5.

Figure 6-5. Array Manipulation VI—Select a Channel

1 Build Array—Combines the sine and square waves into one 2D array.
2 Index Array—Extracts row 0 or 1 from the 2D array. The output from this function is a 1D array and is
the waveform you select with the Select Channel
control. The waveform is displayed on the Single Channel of Data Waveform Graph and the Single
Channel of Data Array indicator.
3 Select Channel—Wire to the row input of the Index Array function.
4 Array Size—Because you are using a 1D array, this function outputs a scalar value.

Note The Select a Channel case uses a property node to change the color of the graph plot.

11. Switch to the front panel and test the Select a Channel case.
On the front panel, click the Select a Channel tab.
Run the VI.
Switch between Channel 0 and Channel 1 and notice the different values shown in the Single Channel
of Data Array indicator.

12. Stop the VI.


13. Switch to the block diagram and select the Waveform Data case.
14. Complete the Waveform Data case block diagram as shown in Figure 6-6.
The waveform datatype is a special kind of cluster that contains additional timing information about the
waveform.

Figure 5-6. Array Manipulation VI—Waveform Data

1 Add—Uses the value from the Offset control to modify the value of the waveform in the waveform
datatype. Notice the value from the Offset control must be coerced to be used with the waveform
datatype.

Note Polymorphism is the ability of VIs and functions to automatically adapt to accept input data of
different data types, including arrays, scalars, and waveforms. VIs and functions are polymoprhic to
varying degrees.

15. Switch to the front panel and test the Waveform Data case.
On the front panel, click the Waveform Data tab.
Run the VI.
Change the value of the Offset control and notice the square wave move on the Waveform Data chart.
16. Stop the VI.
17. Switch to the block diagram and select the All Data Channel case.
18. Complete the All Data Channel case as shown in Figure 6-7.
Figure 5-7. Array Manipulation VI—All Data

1 Add—Modify the same data in one array by adding the value of the Channel 1 Offset to each element of
the array.
2 For Loop—Extracts each element of the array using auto indexing so that the Add function in the For
Loop can add the scalar value.
3 Build Array—Takes the two 1D arrays and builds a 2D array. Each 1D array becomes a row in the 2D
array.
4 Array Size—Outputs a 1D array where each element shows the size of each dimension. In this exercise,
you have 2 elements of data for the number of rows and columns.
5 All Data Channel and Data Channel Array indicators display the same data.
Note The polymorphic functionality of LabVIEW functions allows you to perform the same operation on
each element without extracting the array elements, as you do with the two Add functions in the All Data
Channel case.

19. Switch to the front panel and test the All Data Channel case.
On the front panel, click the All Data Channel tab.
Run the VI.
Change the value of the Channel 1 Offset control and observe the behavior.
20. Stop the VI.
21. Switch to the block diagram and select the Waveform Subset case.
22. Complete the Waveform Subset case as shown in Figure 6-8.
Figure 6-8. Array Manipulation VI—Waveform Subset

1 Array Subset—Extracts a subset of an existing array. In this exercise, you use this function to zoom in
on a subset of the waveform you generated.
2 Numeric Constant—These constants specify that the function extract the first two rows starting at
element 0.
3 Start Value—Sets the start index. The default value is set to start at element 0.
4 Length—Sets the number of elements to extract. The default value is set to output 1000 elements.
24. Switch to the front panel and test the Waveform Subset case.
On the front panel, click the Waveform Subset tab.
Run the VI.
Change value of the Start Value and Length sliders and notice that the Subset Data waveform graph
x-axis starts at zero and finishes at the number of elements in the new array. The x-axis starts at zero
because the VI creates a brand new array and the graph does not know where the data was located in the
original array.

25. Stop the VI.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy