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 #87452 is a reply to message #87449] Tue, 04 February 2014 05:31 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
sid writes:

> The main problem is, I will have a resultant array of
> n=dblarr(i,j)
> j=25,
> but i is varying say around 800 to 900.
> so i should name it in a for loop like,
> n1=n(800,1)
> n2=n(830,2)
> n3=n(840,3)
> .
> .
> .
> like this it has to go till 25.
> Finally I have to save this n1,n2,n3,....,n25 into separate files,
> like
> openw,2,'test.dat'
> printf,2,n1
> close,2
> till n25
> So I have to find a way to save in a variable which varies like n1,n2,...,n25

You want to use a list, rather than an array. The list will allow you to
store vectors of various lengths, and you can then treat the list
variable as if it were an array when saving the data, etc.

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
[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: Wed Oct 08 19:30:56 PDT 2025

Total time taken to generate the page: 0.00418 seconds