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 #55534 is a reply to message #55436] Thu, 23 August 2007 08:55 Go to previous message
jeffwax1 is currently offline  jeffwax1
Messages: 10
Registered: June 2004
Junior Member
On Aug 23, 10:39 am, Conor <cmanc...@gmail.com> wrote:
> On Aug 23, 11:33 am, jeffw...@hotmail.com wrote:
>
>
>
>>> 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.
>
> Oops! Sorry, that's my mistake (I only use common blocks
> occasionally). The exact syntax is:
>
> common share,A



Yeah, just figured out it was a mistake with excess commas. With the
fix it did work. Thanks.
[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: Sat Oct 11 02:02:10 PDT 2025

Total time taken to generate the page: 1.76161 seconds