Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
Hi all, I have a small problem with strings in IDL which i'm not quite able to figure out. Here's the small piece of code. for k=0,files-1 do begin outfilename=output_path+'veg_'+strtrim(k,2)+'_days_.dat' ENVI_WRITE_ENVI_FILE, veg[*,*,k], out_name=outfilename,map_info=result endfor The code works with the following format: My output looks like filenames such as veg_1_days, veg_2_days...veg_10_days.dat etc. As you can see, when it reaches 10, there is an extra character in the filename which is causing a problem for me to layerstack in ENVI. Is there a way to add a preceding 0 to 1, 2...9 so that the number of characters in the filenames are the same? I want something like veg_01, veg_02..veg_09, and then veg_10,veg_11 etc. If it reached 100, i'd want veg_001,veg_002..and veg_100. Thanks, Raghu