Call input file

Forum for OpenSees users to post questions, comments, etc. on the use of the OpenSees interpreter, OpenSees.exe

Moderators: silvia, selimgunay, Moderators

Post Reply
reza2333
Posts: 7
Joined: Wed Jun 27, 2007 10:16 am

Call input file

Post by reza2333 »

How can I call variables from a text file in my input file ?
fmk
Site Admin
Posts: 5884
Joined: Fri Jun 11, 2004 2:33 pm
Location: UC Berkeley
Contact:

Post by fmk »

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

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
would produce:
1
2
3
4.5
6.0
7.0
8.0
9.0
10.0
Post Reply