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

Home » Public Forums » archive » Re: dymamic memory allocation
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: dymamic memory allocation [message #41886 is a reply to message #41882] Sun, 05 December 2004 18:16 Go to previous message
Mark Hadfield is currently offline  Mark Hadfield
Messages: 783
Registered: May 1995
Senior Member
Francois wrote:
> Hello,
>
> How to dynamically allow memory for an array ?
> For example, to declare a 2D array of 30 columns by 40 lines, you type
> this code:
> a = intarr(30,40)
>
> But if you don't know, before compilation, the number of dimensions of
> the array, how do we do this ?
>
> Thank you,
>
> Fran�ois.

In IDL, variables are created at run time and do not need to be
"declared" beforehand. Consider the following code

pro test
a = dist(30,40)
surface, a
a = 'My string'
print, a
end

The first line of the procedure creates a floating point array
dimensioned (30,40) and associates the variable name "a" with it. (The
dimensions in this example are known at compile time, but they do not
need to be.) The second line plots it as a surface plot. The third line
creates a string and associates the name "a" with it. (The array created
in line 1 is no longer accessible to IDL and the memory associated with
it may--or may not--be returned to the operating system.) The fourth
line prints the string to the console.


--
Mark Hadfield "Ka puwaha te tai nei, Hoea tatou"
m.hadfield@niwa.co.nz
National Institute for Water and Atmospheric Research (NIWA)
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Continuing a poscript plot after closing
Next Topic: File Pointer

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

Current Time: Sat Oct 11 11:20:40 PDT 2025

Total time taken to generate the page: 1.04005 seconds