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 #87456 is a reply to message #87454] Tue, 04 February 2014 06:09 Go to previous messageGo to previous message
Fabzi is currently offline  Fabzi
Messages: 305
Registered: July 2010
Senior Member
Hi,


On 04.02.2014 14:57, David Fanning wrote:
> I think in the hands of someone who knows what they are doing this can
> be a powerful programming technique. I rarely see it used in those kind
> of hands.:-)

what David means is that most experienced programmers probably never
even *needed* to create a variable dynamically.

If the technique is available, this does not mean this technique is
suitable for your problem. If you think you need X variables named
var_0, var_1, ---, var_X than the algorithm you are thinking of is
probably not the best one.

In this case, a list (for IDL8+) or a pointer array (all versions) is
probably a better solution.

For example:

var = PTRARR(25)
for j=0, 24 do var[j]=PTR_NEW(whatever_you_want_to_put_inside)

Fab
[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: Fri Oct 10 12:54:28 PDT 2025

Total time taken to generate the page: 1.75867 seconds