Re: write data to an excell file [message #42478 is a reply to message #42476] |
Wed, 09 February 2005 08:44   |
Rick Towler
Messages: 821 Registered: August 1998
|
Senior Member |
|
|
Hello Matthias,
It looks to me that you are simply creating ASCII files with an .xls
extension. This really isn't an excel file. I have looked into the
.xls format in the past (it was called "biff" at one point) hoping to
create an IDL program that could write native .xls files but I never
found a published format.
You may find .slk (symbolic link) files are a good alternative. IDL has
a built in function to create .slk files called WRITE_SYLK. In your
case you would simply store all of your data in one array (assuming that
it was of the same data type):
data = [[kk],[xtt],[Tk]]
ok = WRITE_SYLK('C:\test.slk', data)
To add more columns you would add in more data.
WRITE_SYLK will not allow you to write column headers which is an
unfortunate limitation. I have modified WRITE_SYLK so you can pass it a
structure which contains your data and the column headers which is nice
since I always forget which column is which when I look at my data in
excel! If you are interested I can make it available to you.
Cheers!
-Rick
I can't post to the newsgroup (server problems). Please forward this to
the list if you find it useful.
Matthias Demuzere wrote:
> Dear,
>
> I have a problem with writing data to an excell datasheet. My aim is to
> write several columns to 1 same datasheet instead of writing the different
> columns to different datasheets.
>
> This is what i did untill now:
> openw,10,'C:\RSI\IDL56SE\Output-Escompte\MarseilleObservatoi re.xls'
> for hour=0,192 do begin
> printf,10,xtt(hour)
> endfor
> close,10
>
> openw,11,'C:\RSI\IDL56SE\Output-Escompte\MarseilleObservatoi re_T_E.xls'
> for kk=0,192 do begin
> printf,11,Tk(kk)
> endfor
> close,11
>
> Now I woulf like for example print in the first column the time (hour),
> expressed by kk, going from 0 to 192 hours.
> In the second column of the same datasheet, i would like to write xtt (hour)
> and in the third column of the same datasheet, i would like to write
> Tk(hour)
>
> Can anyone help me with that?
>
> Kind Regard,
>
> Matthias Demuzere
|
|
|