Keithley 708B Reference Manual page 218

Switching matrix
Hide thumbs Also See for 708B:
Table of Contents

Advertisement

Models 707B and 708B Switching Matrix Reference Manual
Example: Numeric for
Code
list = {"One", "Two", "Three", "Four", "Five", "Six"}
---------- For loop -----------
print("Counting from one to three:")
for element = 1, 3 do
print(element, list[element])
end
print("Counting from one to four, in steps of two:")
for element = 1, 4, 2 do
print(element, list[element])
end
Notes and output
The numeric for loop repeats a block of code while a control variable runs through an
arithmetic progression.
Counting from one to three:
1.000000000e+00
2.000000000e+00
3.000000000e+00
Counting from one to four, in steps of two:
1.000000000e+00
3.000000000e+00
Example: Generic for
Code
days = {"Sunday",
"Monday",
"Wednesday",
"Friday",
for i, v in ipairs(days) do
print(days[i], i, v)
end
Notes and output
The generic for statement works by using functions called iterators. On each iteration, the
iterator function is called to produce a new value, stopping when this new value is nil.
Output
Sunday
Monday
Tuesday
Wednesday
Thursday
Friday
Saturday
707B-901-01 Rev. A / August 2010
One
Two
Three
One
Three
"Tuesday",
"Thursday",
"Saturday"}
1.000000000e+00
Sunday
2.000000000e+00
Monday
3.000000000e+00
Tuesday
4.000000000e+00
Wednesday
5.000000000e+00
Thursday
6.000000000e+00
Friday
7.000000000e+00
Saturday
Section 6: Instrument programming
6-27

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

707b

Table of Contents