Based on: Programming in MATLAB-Simple While Loop Exercises by Darryl Morrell
Summary: This module provides several simple exercises designed to test and increase your understanding of while loops in LabVIEW MathScript.
How many times will this loop print 'Hello World'?
n = 10;
while n > 0
disp('Hello World')
n = n - 1;
end
10 times.
How many times will this loop print 'Hello World'?
n = 1;
while n > 0
disp('Hello World')
n = n + 1;
end
This loop will continue to print 'Hello World' until the user stops the program. You can stop a program by holding down the 'Ctrl' key and simultaneously pressing the 'c' key.
What values will the following LABVIEW MATHSCRIPT code print?
a = 1
while a < 100
a = a*2
end
a =
1
a =
2
a =
4
a =
8
a =
16
a =
32
a =
64
a =
128What values will the following LABVIEW MATHSCRIPT code print?
a = 1;
n = 1;
while a < 100
a = a*n
n = n + 1;
end
a =
1
a =
2
a =
6
a =
24
a =
120
"This course provides a brief introduction to LabVIEW MathScript, the textual math componenet of LabVIEW. The modules for this course include typical syntax and programming methods commonly used […]"