Re: Auto-path finding when writing file [message #94594 is a reply to message #94593] |
Tue, 18 July 2017 08:48  |
Markus Schmassmann
Messages: 129 Registered: April 2016
|
Senior Member |
|
|
On 07/18/2017 04:23 PM, thtran296@gmail.com wrote:
> Thank you so much guys for helping me with IDL recently.
> I truly appreciate all the help and feedback.
>
> So I have successfully written a loop that will write 365 separate files (named Day1, Day2, Day3, .. so on).
> The problem is, all of these text files were placed in this directory: HDD-Users-Sam
> This is messy.
>
> I have already created 12 separate folders (named January to December). Ultimately, I want IDL to write the above 365 files to the appropriate folder.
> For example, the file Day1 would be written in the folder January, and the file Day350 would be written in the folder December.
>
> How would I do this?
> Again, thank you very much.
>
> Here's what I have so far:
> data = .......... (my data goes in here)
> arr = string(intarr(1,365))
month=[replicate('jan',31),replicate('feb',28),replicate('ma r',31)]
> for j = 0,364 do begin
arr(j) = month[j]+'/Day'+ strtrim(string(j),2) + '.dat'
> get_lun, unit
> openw, unit, arr(j), /get_lun
> printf, unit, data
> close, unit
> endfor
you will need to put in the rest of the months... not to mention leap year.
see http://harrisgeospatial.com/docs/caldat.html
|
|
|