comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » IDL string trim
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
IDL string trim [message #61154] Sun, 06 July 2008 14:02
raghuram is currently offline  raghuram
Messages: 32
Registered: February 2008
Member
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
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: MONTHLY EARNING $1000 TO$10000
Next Topic: Getting mean from HDF SD files - stack in envi or read into IDL array?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sun Oct 12 12:53:47 PDT 2025

Total time taken to generate the page: 0.55933 seconds