Vector in opensees

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

Moderators: silvia, selimgunay, Moderators

Post Reply
ssami
Posts: 68
Joined: Tue Dec 17, 2013 5:10 am

Vector in opensees

Post by ssami »

Hi everybody

I have many numbers that produce in OpenSees inside a loop and I want to assemble them in a vector.
for example the numbers "1,2,3,4,5,6,7" have been produced in OpenSees inside a loop as follows and I want to assemble them in vector x, i.e, x=[1 2 3 4 5 6 7].

for {set i 1} {$i < 8} {incr i 1} {
set w $i
}

How can I assemble these numbers in a vector?

Thanks so much
fmk
Site Admin
Posts: 5884
Joined: Fri Jun 11, 2004 2:33 pm
Location: UC Berkeley
Contact:

Re: Vector in opensees

Post by fmk »

wither create the list directly or create a blank list and use the lappend command
markhenry912
Posts: 2
Joined: Wed Jun 06, 2012 6:49 am
Location: NewYork City

Re: Vector in opensees

Post by markhenry912 »

fmk wrote:
> wither create the list directly or create a blank list and use the lappend
> command

do you think by creating a list directly it will work? because i am also .facing this problem.
Busy on the comal river a great place for new braunfels tubing
ssami
Posts: 68
Joined: Tue Dec 17, 2013 5:10 am

Re: Vector in opensees

Post by ssami »

At first I appreciate Dr fmk, then I answer to dear markhenry912. I did according to fmk's reply and succeed. so I consider the example stated previously with use of lappend command:

###########################################
for {set i 1} {$i < 8} {incr i 1} {
set w $i
lappend var $w
}

puts $var
###########################################

After running above script, you will see this vector:
1 2 3 4 5 6 7
Post Reply