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
Vector in opensees
Moderators: silvia, selimgunay, Moderators
Re: Vector in opensees
wither create the list directly or create a blank list and use the lappend command
-
- Posts: 2
- Joined: Wed Jun 06, 2012 6:49 am
- Location: NewYork City
Re: Vector in opensees
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.
> 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
Re: Vector in opensees
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
###########################################
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