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

Home » Public Forums » archive » name a variable with number
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: name a variable with number [message #87460 is a reply to message #87459] Tue, 04 February 2014 10:00 Go to previous messageGo to previous message
Fabzi is currently offline  Fabzi
Messages: 305
Registered: July 2010
Senior Member
On 04.02.2014 18:28, rjp23@le.ac.uk wrote:
> Is there a better (generic) way of doing this?

I am not an expert enough, but if you are using a loop to generate
variables dynamically, and then using a loop again somewhere else to
read them, then you use the variables as "data holder" and this "data
holder" could be anything else. You have created a variable
modelB_variableA, what do you do with it afterwards? How do you check
later in your code that ModelX_VariableY is available to continue
processing?
This is much easier to test if you have a variable, say, ModelVar as a
pointer array and check if ModelVar[X,Y] is a valid pointer, for example.

For the problem you describe, HASH() in IDL 8+ could quite adapted. For
earlier versions, I guess a solution based on structures and/or pointers
could work.

There is nothing "wrong" in generating variables dynamically, it just
makes code difficult to understand and to debug. If you have something
that works, it's probably not necessary to change your code now, I guess...
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: accessing IDL internal (aka "built-in") routines
Next Topic: Error using data structures while reading ASCII file with different data types

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

Current Time: Thu Oct 09 21:08:45 PDT 2025

Total time taken to generate the page: 0.87494 seconds