help with string manipulation [message #89343] |
Thu, 21 August 2014 09:14  |
g.nacarts
Messages: 148 Registered: November 2013
|
Senior Member |
|
|
Hi all
I have data named like this:
dat(001,001)
dat(001,002)
dat(001,003)
dat(001,004) and so on till a(001,200).
I had import my data like this:
Data = 'c:\path\dat(001,'+strcompress(i)+').csv'
The first part of dat(001,001)is fixed is always 001 but the second part is a string of 3 numbers which have to be created. I want to convert these numbers from 0-200 into a string of 3 numbers. Can anyone knows how to do it?
Many Thanks
|
|
|
Re: help with string manipulation [message #89344 is a reply to message #89343] |
Thu, 21 August 2014 09:24  |
Heinz Stege
Messages: 189 Registered: January 2003
|
Senior Member |
|
|
On Thu, 21 Aug 2014 09:14:04 -0700 (PDT), g.nacarts@gmail.com wrote:
> Hi all
>
> I have data named like this:
>
> dat(001,001)
> dat(001,002)
> dat(001,003)
> dat(001,004) and so on till a(001,200).
>
> I had import my data like this:
>
> Data = 'c:\path\dat(001,'+strcompress(i)+').csv'
>
> The first part of dat(001,001)is fixed is always 001 but the second part is a string of 3 numbers which have to be created. I want to convert these numbers from 0-200 into a string of 3 numbers. Can anyone knows how to do it?
>
> Many Thanks
Please try:
filename = 'c:\path\dat(001,'+string(i,format='(i3.3)')+').csv'
If you want do go the "IDL way", you can create a string array,
including all 201 names:
filenames =
'c:\path\dat(001,'+string(indgen(201),format='(i3.3)')+').cs v'
HTH, Heinz
|
|
|