Call input file
Moderators: silvia, selimgunay, Moderators
Call input file
How can I call variables from a text file in my input file ?
you have to open up the file, read the lines
and variables. for e.g. if the file fileName
contains:
1 2 3
4.5 6.0 7.0
8.0 9.0 10.0
the following
would produce:
1
2
3
4.5
6.0
7.0
8.0
9.0
10.0
and variables. for e.g. if the file fileName
contains:
1 2 3
4.5 6.0 7.0
8.0 9.0 10.0
the following
Code: Select all
set inFileID [open fileName r]
foreach line [split [read $inFileID] \n] {
foreach parameter [split $line] {
//.. do what you want to do
puts $parameter
}
}
close $inFileID
1
2
3
4.5
6.0
7.0
8.0
9.0
10.0