Вы находитесь на странице: 1из 11

Name : Tian Setiawan

ID : 1A7S6002
HW6

Explanation:
Array elements are accessed by their indices; each element’s index is in range 0 to N − 1, where
N is the total number of elements in the array. A one dimensional (1D) array shown in Table
above illustrates this structure. The first element has index 2, the second element has index 2, and
so on. Generally, waveforms are often stored in arrays, with each point in the waveform comprising
an element of the array. Arrays are also useful for storing data generated in loops, where each loop
iteration generates one element of the array.

Explanation:
Two For Loops, one inside the other, can be used to create a 2D array on the front panel. The inner
For Loop creates a row, and the outer For Loop “stacks” these rows to fill in the columns of the
matrix. In two For Loops creating a 2D array of random numbers using autoindexing, notice that
a 2D array wire is even thicker than a 1D array wire as shown in Figure above.

Explanation:
Figure above shows autoindex enabled in a For loop. Here the wire appears thicker since the output
is wired to a 1D array indicator. To wire a scalar value out of a For Loop without creating an array,
autoindexing must be disabled. This can be done by popping up on the tunnel (the square with the
[] symbol) and choosing Disable Indexing from the tunnel’s Pop-up menu. Since autoindexing is
disabled by default, to wire array data out of a While Loop, the user must pop-up on the tunnel and
select Enable Indexing. When autoindexing is disabled, only the last value returned from the
Random Number (0–1) function passes out of the loop. Notice that the wire remains the same size
after it leaves the loop.

Explanation:
It returns the number of elements in the input array. If the input array is n dimensional, Array Size
returns an n-element, 1D array, with each element containing the size of one of the array’s
dimensions. The example in Figure above shows the size of the given array is 5.
Explanation:
This is Index Array example. It returns the element or subarray of n-dimension array at index.
Figure above illustrates the usage of Index array. The index is 2 so the element box will display
the data in column 2 which is 6.

Explanation:
Index array can also be used to extract a row or column of a 2D array to create a subarray of the
original. To do so, the 2D array is wired to the input of the function. Here two index terminals are
available. The top index terminal indicates the row, and the second terminal indicates the column.
The user can wire inputs to both index terminals to index a single element, or wire only one
terminal to extract a row or column of data as illustrated in Figure above. The index consist of
column and row. The column is 2 and row is 2 so the element box will display data on row 2
column 2 which is 8.
Explanation :
Build Array has two types of inputs, array and element, so that it can assemble an array from both
array and single-valued inputs. The Build Array function input will automatically adapt to an
element or an array input, depending on the value wired to it. Build Array can also build or add
elements to multidimensional arrays.
From the example above, can be explained that the Array 8 box will be showing the array number
from the Build array elements, and the shown array can be controlled by the Array 8 box.

Explanation :
Array Subset returns a portion of an array starting at index and containing length elements.From
the example above, can be explained that the elements of the Subarray box can be controlled by
the value of “length” and “index” box.
Explanation :
Insert into Array inserts an element or subarray into n-dim array at the point specified in index.
When an array is wired to this function, the function resizes automatically to display index inputs
for each dimension in the array. If the user does not wire any index inputs, the function appends
the new element or subarray to the end of the n-dim array.
From the example above, can be explained that in the input array there are some array that inserted
from the Subarray box, the array that inserted is depends on the value number of index box.

Explanation :
Rotates the elements of array by the number of places and in the direction indicated by n. The
connector pane displays the default data types for this polymorphic function.
From the example above, can be explained that the Array (Last n Element First) box will be
showing the rotated array from the Array box and the rotating is depends on the value of the “n”
box.
Explanation :
Reverses the order of the elements in array as shown in above. The connector pane displays the
default data types for this polymorphic function.
From the example above, can be explained that the Reversed Array box will be showing the
“Reversed” array from the Array box.

Explanation :
Search 1D array searches for an element in a 1D array starting at start index as illustrated in picture
above. There is no need to sort the array before calling this function, because the search is linear.
The connector pane displays the default data types for this polymorphic function
From the example above, can be explained that if we search the number “9” in the element 2 box,
so the index of element box will be showing number “1”, which is the meaning is the number “9”
array is located in the 1th box of the Search 1D array box.
Explanation :
Split 1D Array divides array at index and returns the two portions as shown in above. The
connector pane displays the default data types for this polymorphic function.
From the example above, can be explained that if the index box filled with “3”, so in the first
subarray box will be showing the 3 first number from the Array box, and in the second subarray
box will be showing the the rest number from the Array box.

Explanation :
Sort 1D array returns a sorted version of array with the elements arranged in ascending order. If
array is an array of clusters, the function sorts the elements by
comparing the first elements. If the first elements match, the function compares the second and
subsequent elements. The connector pane displays the default data types for this polymorphic
function. Like the example the mixed array number will be sorted from the lowest number to the
highest number by using Sort 1D Array.
Explanation :
Returns the maximum and minimum values found in array, along with the
indexes for each value as shown in Fig. below. The connector pane displays the default data types
for this polymorphic function. If a numeric array has one dimension, the max index and min index
outputs are scalar integers. If a numeric array has more than one dimension, these outputs are 1D
arrays that contain the indexes of the maximum and minimum values. From the example we know
that the maximum and minimum value which is input in first array.

Explanation :
Multiply function is added from the Arithmetic and Comparison sub palette
of the Functions palette and the wiring is done as shown in Fig. below. Multiply function is used
for multiplying Array 14 and Array 15. The result of multiplying is based on the input in Array 14
and Array 15.
Explanation :
Another handy feature found most useful is the polymorphism of the LabVIEW arithmetic
functions, Add, Multiply, Divide, and so on. Polymorphism is just a big word for a simple
principle. The inputs to these functions can be of different size and representation. For example, a
scalar can be added to an array or two arrays can be added
together using the same function. The example is like on the picture above which the sum result is
the sum from the array input and the numeric constant. If two arrays are wired to the Add function,
the function adds each element of one array to the corresponding element of the other array and
returns the array just like the multiply array before.

Explanation :
The Bundle function (Cluster palette) in Fig. below assembles individual components
into a new cluster or allows us to replace elements in an existing cluster. The function appears as
the icon at the left when one places it in the diagram window. Dragging a corner of the function
with positioning tool can increase the number of
inputs. When wired on each input terminal, a symbol representing the data type of the
wired element appears on the empty terminal. he order of the resultant cluster will be the order of
inputs to the Bundle. To create a new cluster the user need not wire an input to the center cluster
input of the Bundle function. This needs to be wired only if elements are replaced in the cluster.

Explanation :
The unbundled function (Cluster palette) in Fig. below splits a cluster into
each of its individual components. The output components are arranged from top to bottom in the
same order they have in the cluster. If they have the same data type, the elements’ order in the
cluster is the only way to distinguish among them. Dragging a corner in the function with the
Positioning tool can increase the
number of outputs. The Unbundled function must be sized to contain the same number of outputs
as there are elements in the input cluster, or it will produce bad
wires. When an input cluster is wired to the correctly sized Unbundled, the
previously blank output terminals will assume the symbols of the data types
in the cluster example has been shown in below. LabVIEW does have a way to bundle and
unbundled clusters using element names.
Explanation:
Sometimes there is no need to assemble or disassemble an entire cluster – the user just needs to
operate on an element or two. This is accomplished using Bundle By Name and Unbundle By
Name functions. Unbundle By Name, also located in the Cluster palette, returns elements whose
name(s) are specified. There is no need to consider cluster order to correct Unbundle function size.
The unbundle function is illustrated in Fig. below.

Вам также может понравиться