[ Home ]
 RASIP Research

[ Academics ]
[ Resources & services ]
[ Newsworthy ]
[ Search ]

REFERENCES : LABVIEW
LabVIEW example: loops

The fourth example presents for loop realization.


Loop realization

C programming language sequence for it is:

 scanf ("%d", &num_of_elem);
 sum = 0;
 for (i=0; i<num_of_elem; i++)
    sum += i + 1;
 printf ("%d", sum);
The fourth line in the source is presented in G programming language by using shift registers (showed on the picture as a triangle turned down on the left side, or enter, and a triangle turned up on the right side, or exit). They return the calculated value from previous iteration to the beginning of the next.

Note: two shift registers at enter would remember values form the last two iterations.

Next example | Introduction to G programming language

Please, send your comments or suggestions to: Armin.Stranjak@fer.hr

-------------------

Copyright 1997. RASIP - Computer Systems and Processes.
Department of Control and Computer Engineering in Automation
Faculty of Electrical Engineering and Computing, Zagreb, Croatia.
Server maintained by www@rasip.fer.hr.