Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Idl-pvware > Re: array conca...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 4 of 9 Topic 5605 of 6457
Post > Topic >>

Re: array concatenation in 2-D

by David Fanning <news@[EMAIL PROTECTED] > Apr 4, 2008 at 01:40 PM

R.G. Stockwell writes:

> If it is always 2 columns by whatever rows, then just concatenate the 
> arrays.
> (you may have to do some tranposes)
> 
> If there is a variable number of columns, then as David says, pointers.

Oh, here (for those you don't have time to read
the Dimensional Juggling and Pointer tutorials):

   PRO Example
   arrayptr = Ptr_New()
   seed = -3L
   FOR j=0,9 DO BEGIN
      points = Randomu(seed, 2)
      Print, 'Points: ', points
      IF j EQ 0 THEN $
         arrayptr = Ptr_New(points) ELSE $
         *arrayptr = [[Tem****ary(*arrayptr)],[points]]
    ENDFOR
    
    Print, 'Print Values in Pointer'
    Print, *arrayPtr
    Ptr_Free, arrayPtr
    END

Results in:

Points:      0.897916     0.558249
Points:      0.766930     0.589101
Points:     0.0603181     0.973112
Points:     0.0378892     0.218058
Points:      0.142394     0.984703
Points:      0.894904     0.947651
Points:      0.804079     0.160385
Points:      0.208246     0.818130
Points:      0.103716     0.741117
Points:     0.0134482    0.0960160
Print Values in Pointer
     0.897916     0.558249
     0.766930     0.589101
    0.0603181     0.973112
    0.0378892     0.218058
     0.142394     0.984703
     0.894904     0.947651
     0.804079     0.160385
     0.208246     0.818130
     0.103716     0.741117
    0.0134482    0.0960160

Cheers,

David
-- 
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming (www.dfanning.com)
Se****e ma de ni thui. ("Perhaps thou speakest truth.")
 




 9 Posts in Topic:
array concatenation in 2-D
elwood <epolomsk@[EMAI  2008-04-04 11:38:54 
Re: array concatenation in 2-D
David Fanning <news@[E  2008-04-04 12:57:21 
Re: array concatenation in 2-D
"R.G. Stockwell"  2008-04-04 13:27:03 
Re: array concatenation in 2-D
David Fanning <news@[E  2008-04-04 13:40:09 
Re: array concatenation in 2-D
Jean H <jghasban@[EMAI  2008-04-04 13:31:13 
Re: array concatenation in 2-D
"ben.bighair" &  2008-04-04 14:25:35 
Re: array concatenation in 2-D
elwood <epolomsk@[EMAI  2008-04-08 18:19:27 
Re: array concatenation in 2-D
Jean H <jghasban@[EMAI  2008-04-09 09:44:29 
Re: array concatenation in 2-D
Spon <christoph.blau@[  2008-04-08 23:37:12 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Dec 3 21:38:23 CST 2008.