Re: globalization of variables [message #51204] |
Tue, 07 November 2006 07:26 |
taejon
Messages: 8 Registered: November 2006
|
Junior Member |
|
|
Thank you very much for your help,the program worked!!
I am going to read the article today in the evening
regards
sven
David Fanning wrote:
> Sven Ohmann writes:
>
>> in the code below I want to use the variable voxel_a0 globally.
>
> I forgot to mention this in my last post, but here is
> an article that you might want to read to improve your
> IDL programs even more
>
> http://www.dfanning.com/tips/namefiles.html
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming: http://www.dfanning.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: globalization of variables [message #51205 is a reply to message #51204] |
Tue, 07 November 2006 07:26  |
taejon
Messages: 8 Registered: November 2006
|
Junior Member |
|
|
Thank you very much for your help, it worked!!!
I am going to read the article today in the evening
regards
sven
David Fanning wrote:
> Sven Ohmann writes:
>
>> in the code below I want to use the variable voxel_a0 globally.
>
> I forgot to mention this in my last post, but here is
> an article that you might want to read to improve your
> IDL programs even more
>
> http://www.dfanning.com/tips/namefiles.html
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming: http://www.dfanning.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
|
Re: globalization of variables [message #51221 is a reply to message #51220] |
Mon, 06 November 2006 06:45  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Sven Ohmann writes:
> in the code below I want to use the variable voxel_a0 globally. That
> means, when I try after compilation (successful) to run the program I
> got the message:
>
> variable is undefined : voxel_a0
>
> In principle I want that after starting the program after pressing the
> 'apply_button' (eventhandler=3Dapplydata_event) the variables should be
> stored globally in the structure pState, so that when proceeding the
> program in the subprogram efgalc1_computedim I want to use them again,
> and later on in other functions or subprograms as well. Any idea ?
The variable isn't created yet when you are storing it
in your state pointer. It is only created *after* the
program runs. So, when you create the state pointer you
have to put "dummy" data there to hold the place for the
real data to be stored there later.
I typically store something there that I would recognize
as "not filled yet". For integers this might be the
number -999, for example. For floating point numbers is might
be !Values.F_NAN. If you have a pointer field
that you don't *know* how to fill, or if what you are
going to fill it with will vary in size or type, then,
of course, you "hold the space" with a null pointer.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|