I use the following proc to read Mass file and save as vector MASS. While the result is: MASS
(0,0) is space, and start from MASS(0,1), MASS(0,2) space aigain
So what can I do to avoid reading spaces.
Thanks
proc ReadOPCdata {inFiledir} {
# Open the input file and catch the error if it can't be read
# Read data for opensee
# inFiledir is the directory where file is saved, and also directory where opensee will run
set fid [open $inFiledir/Mass r]; #assign a channel to the file
set rowslst [split [read $fid] \n]; #make a list of lines
close $fid
set i 0
foreach rw $rowslst {
# set elmlst [split $rw]; #make a list of elements on each line
set j 0
foreach elm [split [regsub { {2,}} $rw " "] ""] {
set MASS($i,$j) $elm;
incr j
}
incr i
}
set fid [open $inFiledir/SectionPro r]; #assign a channel to the file
set rowslst [split [read $fid] \n]; #make a list of lines
close $fid
set i 0
foreach rw $rowslst {
# set elmlst [split $rw ,]; #make a list of elements on each line
set j 0
foreach elm [split [regsub { {2,}} $rw " "] ""] {
set SectionPro($i,$j) $elm;
incr j
}
incr i
}
}
Mass data:
1.1113750e+004 2.2227500e+004 2.2227500e+004 1.1113750e+004 1.0755625e+004 2.1511250e+004 2.1511250e+004 1.0755625e+004 1.0755625e+004 2.1511250e+004 2.1511250e+004 1.0755625e+004 1.0755625e+004 2.1511250e+004 2.1511250e+004 1.0755625e+004 1.0755625e+004 2.1511250e+004 2.1511250e+004 1.0755625e+004 9.1440625e+003 1.8288125e+004 1.8288125e+004 9.1440625e+003
Having problem in reading data, reading space
Moderators: silvia, selimgunay, Moderators
Re: Having problem in reading data, reading space
I do not understand your question. Would you explain it again?