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

Home » Public Forums » archive » Re: Passing variables
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: Passing variables [message #55437 is a reply to message #55436] Thu, 23 August 2007 08:33 Go to previous messageGo to previous message
jeffwax1 is currently offline  jeffwax1
Messages: 10
Registered: June 2004
Junior Member
> The easiest way is typically to use a common block. At the start of
> everyone program that want to access some variables, put a line like
> this:
>
> common, block_name, variable1, variable2, ....
>
> A couple rules about common blocks:
>
> 1) The names of the variables don't have to be the same in every
> program.
> 2) The number of variables matter. All common blocks should have the
> same number of variables.
> 3) The positions of the variables matter. Since names don't matter,
> the first variable in one program will always be the same as the first
> variable in another program, even if they have much different names
> 4) Common blocks last until you quit IDL. If you declare it once, it
> stays declared.
> 5) Common blocks can't be extended. This means that if you create a
> common block and later realize you need to add more variables to it,
> you'll have to quit IDL (or type .reset) in order to "destroy" the
> common block.




In the help files the only examples I see of common blocks are inside
procedures. Can I put them inside a function, or even my main
program? I tried putting:

common, share, B

in both my main program and the program with the function I'm using,
and both came back as syntax errors.

On second thought, after trying to answer my own program, I made a
test program along the lines of:

pro test
common, share, A

...

end


IDL is insisting that the "common,share,A" is a syntax error.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Reading Landsat FAST data in ENVI
Next Topic: reading envi file in IDL

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

Current Time: Fri Oct 10 16:36:25 PDT 2025

Total time taken to generate the page: 0.88182 seconds