Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
# set a matrix file
set fn myfile
set fp [open $fn w]
foreach row {0 1 2} {
foreach col {0 1 2} {
# write and element and its separator
puts -nonewline $fp "r${row}c${col} "
}
# write the end of line
puts $fp ""
}
close $fp
# the proc
proc getxy {file row col} {
set fp [open $file]
set n -1
while {![eof $fp]} {
# read a line of elements
set line([incr n]) [gets $fp]
}
close $fp
# get the line
set theline $line($row)
# return the element
return [lindex $theline $col]
}
# get the 3rd element of the 2nd row
puts [getxy $fn 1 2]