Re: Filename as a Variable: Help requested [message #40177] |
Wed, 14 July 2004 13:50 |
R.G. Stockwell
Messages: 363 Registered: July 1999
|
Senior Member |
|
|
"yaj" <tgupta2000@hotmail.com> wrote in message news:cd45mc$8os$1@sunburst.ccs.yorku.ca...
> Need help with saving a filename as a variable - to make and save multiple
...
> for i=1,40 do begin
> step = 75.
> set_plot,'PS'
> name='bkg-???-VARIABLE-HERE-???.ps'
...
> endfor
>
>
> Thanks in advance
> Yaj
> mail: yajnaval.NOSPAM.@.hotmail.com
Just use + to concatenate, and string() to cast to string.
name = 'bkg-'+string(i)+'.ps'
Now, one can get blanks, so you can put the whole string into strcompress()
with the /remove_all keyword
name = strcompress('bkg-'+string(i)+'.ps',/rem)
Also, string allows the use of format strings, which is nice if you want alphabetical
listings of the files (the below will add leading zeros for instance.)
name = strcompress('bkg-'+string(i,format='(i6.3)')+'.ps',/rem)
Cheers,
bob
|
|
|