Hi Lin,
You can use the function stringtochar to convert the string to
characters, and then don't select the last 4 characters when you pass
the character array into chartostring:
res = True
....
temp = stringtochar(all_files(i))
res_at_gsnLeftString = chartostring(temp(:dimsizes(temp)-5))
delete(temp)
Good luck,
Adam
LEO_ARIES wrote:
> hi,all
>
> I have a small question on the string manipulation in NCL.
>
> Here below is some of my script:
>
> all_files = systemfunc ("ls " + "*.dat")
> n = dimsizes(all_files)
>
> do i = 0,n-1
> x =asciiread(all_files(i),-1,"float")
> .....
> wks = gsn_open_wks("eps",all_files(i))
> res = True
> ......
> res_at_gsnLeftString <mailto:res_at_gsnLeftString> = all_files(i)
> ? Notice : here is the problem i want to resolve, the last 4 character
> of the string "all_files(i)"
> is
> ".dat", but I don't want them in the resource of "gsnLeftString".
>
> Could I have any solution to get all the other character except
> the ".dat" ?
> plot = .....
> end do
>
> end
>
>
> Thanks in advance
>
>
> Lin
>
>
> ------------------------------------------------------------------------
> LEO_ARIES
> 2007-03-27
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk_at_ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
-- -------------------------------------------------------------- Adam Phillips asphilli_at_ucar.edu National Center for Atmospheric Research tel: (303) 497-1726 ESSL/CGD/CAS fax: (303) 497-1333 P.O. Box 3000 Boulder, CO 80307-3000 http://www.cgd.ucar.edu/cas/asphilli _______________________________________________ ncl-talk mailing list ncl-talk_at_ucar.edu http://mailman.ucar.edu/mailman/listinfo/ncl-talkReceived on Mon Mar 26 2007 - 11:55:24 MDT
This archive was generated by hypermail 2.2.0 : Wed Mar 28 2007 - 16:24:59 MDT