# 0.6 Data flow control  (Page 3/3)

 Page 3 / 3

## Continue if true

At times it is more convenient to let the while loop iterate while the condition is True. To change the loop condition , right click on the loop condition icon and select Continue if True from the pop-up menu.

[link] shows the Loop Condition set to Continue if True .

## Shift registers

Programmatically, while loop shift registers are identical to for loop shift registers . Refer to [link] for the discussion. However, an example is provided to illustrate the use of shift registers in while loops.

In the following example, Euler’s number e is computed to the specified accuracy using the infinite series

$e=\sum _{n=0}^{n=\infty }\frac{1}{n!}=1+\sum _{n=0}^{n=\infty }\frac{1}{n!}=1+\frac{1}{1!}+\frac{1}{2!}+\frac{1}{3!}+\dots =2.7182818284$

Notice that two shift registers keep track of the factorial and the sum. Also notice the dot in the multiplication. This is because the loop iteration is an integer 32 data type and the input from one of the shift registers is double precision numeric. The dot represents that the integer 32 data type has been coerced into a double precision number.

Save the program as e.vi . The result of running this program is shown in [link] .

## Enabling auto-indexing

By default, while loops are auto-indexed disabled. In order for while loops to process and generate arrays, the loop tunnel must be enabled to auto-indexed arrays.

To enable auto-indexing, right click on the loop tunnel and select Enable Indexing from the pop-up menu.

In this example the while loop appropriately generates a 1,000 element numeric array with random numbers.

## Sequence

Although G was designed to easily develop interactive, parallel programs, it is sometimes necessary to execute diagrams in sequential order. The sequence structure allows G diagrams to execute sequentially.

The following examples time in milliseconds (ms) the execution of a G diagram. The sequence of events is get a start time stamp, execute the diagram, get stop time stamp and take the difference between the stop and start times to determine the execution time.

## Flat sequence

Flat Sequences always execute left to right. A Flat Sequence structure starts with a single frame and allows a user to visualize the diagram sequences.

To add frames to a sequence, right click on the sequence structure and select either Add Frame After or Add Frame Before from the pop-up menu according to the program’s needs.

Add two more frames to the sequence structure to get a three frame sequence as shown in [link] .

From the Functions>>Programming>>Timing menu select Tick Count (ms) function.

Drop the Tick Count (ms) function in the first (left most) frame of this sequence. Make a copy of the Tick Count function and place it on the third (right most) frame as shown in [link] .

Add a For Loop that iterates 5,000 times to the second frame. Add a subtract operator, an unsigned integer 32 output and complete the program as shown in [link] . The execution of this program shows the time in milliseconds it took for the 2 nd sequential frame to execute.

## Stacked sequence

A Stacked Sequence provides a more compact representation of program sequences. It is programmatically identical to the Flat Sequence with the exception that a Sequence Local enables data to flow to subsequent frames. Additionally, as frames are added, a Sequence Selector provides access to the desired frame (see [link] ).

For this timing example, start with a Stacked Sequence and add 3 more frames. The sequence frames are labeled 0, 1, 2 and 3 and will execute in that order.

Go to the first frame (frame 0) and add a Tick Count (ms) function. Right click on the sequence structure and select Add Sequence Local from the pop-up menu.

The Sequence Local is shown as an undefined tunnel. Wire the Tick Count (ms) function to the Sequence Local to define the tunnel data type and data flow. Data can now flow from frame 0 to the other frames as needed.

Go to the next frame sequence (frame 1) and enter the program to be timed.

Go to the third frame of the sequence (frame 2), add a Tick Count (ms) function, add another Sequence Local and wire the Tick Count (ms) to the new Sequence Local . The wired sequence frame is shown in [link] .

Go to the last frame (frame 3) and add a Subtract function. Wire the Sequence Locals from frame 2 and frame 0 to the Subtract function as shown in [link] . To complete the diagram, wire the output of the Subtract function to the unsigned integer 32 output.

It is important to note that the programs in [link] and [link] are programmatically identical.

how can chip be made from sand
is this allso about nanoscale material
Almas
are nano particles real
yeah
Joseph
Hello, if I study Physics teacher in bachelor, can I study Nanotechnology in master?
no can't
Lohitha
where is the latest information on a no technology how can I find it
William
currently
William
where we get a research paper on Nano chemistry....?
nanopartical of organic/inorganic / physical chemistry , pdf / thesis / review
Ali
what are the products of Nano chemistry?
There are lots of products of nano chemistry... Like nano coatings.....carbon fiber.. And lots of others..
learn
Even nanotechnology is pretty much all about chemistry... Its the chemistry on quantum or atomic level
learn
da
no nanotechnology is also a part of physics and maths it requires angle formulas and some pressure regarding concepts
Bhagvanji
hey
Giriraj
Preparation and Applications of Nanomaterial for Drug Delivery
revolt
da
Application of nanotechnology in medicine
has a lot of application modern world
Kamaluddeen
yes
narayan
what is variations in raman spectra for nanomaterials
ya I also want to know the raman spectra
Bhagvanji
I only see partial conversation and what's the question here!
what about nanotechnology for water purification
please someone correct me if I'm wrong but I think one can use nanoparticles, specially silver nanoparticles for water treatment.
Damian
yes that's correct
Professor
I think
Professor
Nasa has use it in the 60's, copper as water purification in the moon travel.
Alexandre
nanocopper obvius
Alexandre
what is the stm
is there industrial application of fullrenes. What is the method to prepare fullrene on large scale.?
Rafiq
industrial application...? mmm I think on the medical side as drug carrier, but you should go deeper on your research, I may be wrong
Damian
How we are making nano material?
what is a peer
What is meant by 'nano scale'?
What is STMs full form?
LITNING
scanning tunneling microscope
Sahil
how nano science is used for hydrophobicity
Santosh
Do u think that Graphene and Fullrene fiber can be used to make Air Plane body structure the lightest and strongest. Rafiq
Rafiq
what is differents between GO and RGO?
Mahi
what is simplest way to understand the applications of nano robots used to detect the cancer affected cell of human body.? How this robot is carried to required site of body cell.? what will be the carrier material and how can be detected that correct delivery of drug is done Rafiq
Rafiq
if virus is killing to make ARTIFICIAL DNA OF GRAPHENE FOR KILLED THE VIRUS .THIS IS OUR ASSUMPTION
Anam
analytical skills graphene is prepared to kill any type viruses .
Anam
Any one who tell me about Preparation and application of Nanomaterial for drug Delivery
Hafiz
what is Nano technology ?
write examples of Nano molecule?
Bob
The nanotechnology is as new science, to scale nanometric
brayan
nanotechnology is the study, desing, synthesis, manipulation and application of materials and functional systems through control of matter at nanoscale
Damian
Got questions? Join the online conversation and get instant answers!