Re: READS-string conversion problem??!! [message #78547] |
Tue, 29 November 2011 05:51  |
anil
Messages: 34 Registered: August 2009
|
Member |
|
|
On Nov 29, 3:34 pm, Kai Muehlbauer <kai.muehlba...@uni-bonn.de> wrote:
> Hi,
>
> as far as I see, there might be a chance that your day and year
> variables are no strings.
>
> Try something like:
>
> filename =
> STRING(year,FORMAT=('I0'))+'_current'+STRING(day,FORMAT=('I0 '))+'.dat'
>
> Please read manual on STRING and FORMAT!
>
> HTH,
> Kai
>
> Am 29.11.2011 14:04, schrieb anil:
>
>> Hi,
>> This might be a very easy task though, I keep missing something and
>> I'm stuck with this type conversion error. My problem is : I have a
>> dataset and in the 6th line of these data, there is some information I
>> want to use to open other files. What I mean is I will gather month-
>> day-year information from this line and by using this I will determine
>> the number of that day for that year( julday(x,y,2002)-
>> julday(1,1,2002) etc..). And then find the files (another data set in
>> the same folder) corresponding to that day. The data set goes like
>> 2002_current211.dat,2002_current218.dat etc.. So I just want to write
>> something like
>> filename=year+'_current'+day+'.dat' which I can not do. Here is the
>> code I have:
>
>> day3=strmid(b,22,2) ; where b is the 6th line.
>> day2=string(day3)
>> day1=fix(day2)
>> day=intarr(1,1)
>> reads,day1,day
>
>> I do the same for year and month also
>
>> numofday=julday(month,day,year)-julday(1,1,year)
>
>> then when I say :
>> filename=year+..............
>> I always get : % Type conversion error: Unable to convert given STRING
>> to Integer. or
>> % Type conversion error: Unable to convert given STRING to Long.
>
>> What is missing or wrong? Help please
>> Regards,
>> Anil
>
>
Thank you so much! It is working finally.
|
|
|