Re: name a variable with number [message #87452 is a reply to message #87449] |
Tue, 04 February 2014 05:31   |
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.")
|
|
|