comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: How to use pointers instead of arrays
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: How to use pointers instead of arrays [message #33125] Tue, 10 December 2002 10:51 Go to previous message
MKatz843 is currently offline  MKatz843
Messages: 98
Registered: March 2002
Member
If your arrays are reasonably sized, there's an even easier way to
appean columns or rows to an array. OK, so it's not the best method
for memory management or speed, but for many applications,
it works just fine.

In IDL you can do this:

a = [1,2,3]
b = [a, 5]
print, b
1 2 3 5
or
c = [5, a]
print, c
5 1 2 3

So in 2-D you can do this
a = indgen(3,3)
print, a
0 1 2
3 4 5
6 7 8
b = [[a],[9,9,9]] ; append a row to the end
print, b
0 1 2
3 4 5
6 7 8
9 9 9
c = [a,transpose([9,9,9])] ; turn a vector into a column and append
print, c
0 1 2 9
3 4 5 9
6 7 8 9
The number of brackets is related to how many dimensions you're
working with. You can do all of this in 3, 4, or more dimensions
if you're willing to keep track of the brackets.

Of course, you can replace the original variable with the same command:
a = [a, something].

For memory usage, it's not the best method; but for coding elegance,
it's quite compact. IDL is great for on-the-fly variable definitions.

I hope this helps,
M. Katz
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: 3D Scatterplots
Next Topic: Re: 2002 IDL Christmas Project

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Oct 11 21:39:33 PDT 2025

Total time taken to generate the page: 1.83704 seconds