Redimensioning a vector

For questions that don't fall into one of the categories above, such as working with the RATS interface, using Wizards, etc.
John_Val
Posts: 25
Joined: Sun May 17, 2009 2:18 pm

Redimensioning a vector

Unread post by John_Val »

Hi,

I want to redimension a vector continously within a do loop.
As a simple example, I wrote

dec vec hhh

do i=1,5
dimension hhh(i)
com hhh(i)=i
end do

dis hhh
NA NA NA NA 5.00000

How can I redimension while keeping all the previous values?
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Redimensioning a vector

Unread post by TomDoan »

John_Val wrote:Hi,

I want to redimension a vector continously within a do loop.
As a simple example, I wrote

dec vec hhh

do i=1,5
dimension hhh(i)
com hhh(i)=i
end do

dis hhh
NA NA NA NA 5.00000

How can I redimension while keeping all the previous values?
You can do that with something like:

Code: Select all

dec vect hhh(0)
do i=1,5
   compute hhh=hhh~~float(i)
end do i
Post Reply