Re: Append to an array [message #5455] |
Thu, 14 December 1995 00:00 |
thompson
Messages: 584 Registered: August 1991
|
Senior Member |
|
|
"Frank J. ?ynes" <frank@spacetec.no> writes:
> khilman@vision.d.umn.edu (Kevin J. Hilman) wrote:
>>
>> Is there an easy way to append an element to a vector, without making
>> a new vector with a bigger size, copying the old vector over and then
>> adding the new element.
>>
>> --
>> Kevin Hilman
>> khilman@d.umn.edu
> Do you mean something like
> ; create vector
> a = findgen(100)
> ; Append an element
> a = [temporary(a), 452]
Although it isn't obvious from the above statements, I believe that Frank
J. ?ynes is correct about what happens internally.
Bill Thompson
|
|
|
Re: Append to an array [message #5460 is a reply to message #5455] |
Wed, 13 December 1995 00:00  |
sjt
Messages: 72 Registered: November 1993
|
Member |
|
|
Kevin J. Hilman (khilman@vision.d.umn.edu) wrote:
: Is there an easy way to append an element to a vector, without making
: a new vector with a bigger size, copying the old vector over and then
: adding the new element.
: --
: Kevin Hilman
: khilman@d.umn.edu
vec = [temporary(vec), new_element]
--
+------------------------+---------------------------------- --+---------+
| James Tappin, | School of Physics & Space Research | O__ |
| sjt@star.sr.bham.ac.uk | University of Birmingham | -- \/` |
| Ph: 0121-414-6462. Fax: 0121-414-3722 | |
+----------------------------------------------------------- --+---------+
|
|
|
Re: Append to an array [message #5461 is a reply to message #5460] |
Wed, 13 December 1995 00:00  |
Frank J. �ynes
Messages: 17 Registered: February 1995
|
Junior Member |
|
|
khilman@vision.d.umn.edu (Kevin J. Hilman) wrote:
>
> Is there an easy way to append an element to a vector, without making
> a new vector with a bigger size, copying the old vector over and then
> adding the new element.
>
> --
> Kevin Hilman
> khilman@d.umn.edu
Do you mean something like
; create vector
a = findgen(100)
; Append an element
a = [temporary(a), 452]
??
--
/* Frank J. �ynes | frank@spacetec.no /*
/* Spacetec a.s | Phone: +47 77684500 Fax: +47 77655859 /*
/* Prestvannv. 38, | /*
/* N-9005 Troms�, Norway | (...with the bravery of being out of range!) /*
|
|
|