Having problem in reading data, reading space

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

Moderators: silvia, selimgunay, Moderators

Post Reply
zhifenl
Posts: 1
Joined: Fri Feb 24, 2012 10:26 am
Location: Clemson University

Having problem in reading data, reading space

Post by zhifenl »

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
vesna
Posts: 3033
Joined: Tue May 23, 2006 11:23 am
Location: UC Berkeley

Re: Having problem in reading data, reading space

Post by vesna »

I do not understand your question. Would you explain it again?
Post Reply