(reformatted version of original post: apparently, rich text formatting is obligatory!)
for this you can try an array of pointers:
--------
; pointer array of 14 rows. allocate pointers, so you can assign them right away.
p = ptrarr(14, /alloc)
; first row: 100 longs
*p[0] = lonarr(100)
; second row: 20 floats
*p[1] = fltarr(20)
; add 1 to all elements of first row
(*p[0]) += 1
; print first row
print, 'first row = ', *p[0]
; assign function to the 20 floats in the second row
(*p[1]) += findgen(20)^1.5
; print second row
print, 'second row = ', *p[1]
; assign new row array to first row.. let's say a 150 doubles
*p[0] = dblarr(150)
; print first row
print, 'first row = ', *p[0]
; what pointers do we have now?
help, /heap
; free pointer array and give back memory to the system
ptr_free, p
; what pointers do we have now? (should be none)
help, /heap
--------
hope this helps,
Pieter van der Meer
SRON - Netherlands Institute for Space Research
|