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

Home » Public Forums » archive » Re: exporting data
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
Re: exporting data [message #20470] Wed, 21 June 2000 00:00
Liam E. Gumley is currently offline  Liam E. Gumley
Messages: 378
Registered: January 2000
Senior Member
Brad Gom wrote:
> If you specifically want to write a file for use in Excel, then its best to
> write a text file where the values are seperated with commas (a CSV file). You
> can use the PRINTF procedure to write formated text to a file, or WRITEU to
> write binary data.
>
> for example:
>
> data=findgen(10,5)
> ;Open LUN 1 for data.csv with write access.
> OPENW, 1, 'data.csv'
> ;Do the output operation to the file.
> PRINTF, 1, data,format='(9(f,","),f)'
> ;Close the file.
> CLOSE, 1
>
> This will print out the contents of the data array, seperated with commas. Look
> at the FORMAT keyword in the help to see how it works.
>
> Brad

You could try the WRITE_SYLK function, which writes a SYLK format file:

IDL> a = dist(256)
IDL> result = write_sylk('test.sylk', a)

Excel97 apparently reads this format, but I have not tried it.

Cheers,
Liam.
http://cimss.ssec.wisc.edu/~gumley
Re: exporting data [message #20473 is a reply to message #20470] Wed, 21 June 2000 00:00 Go to previous message
Brad Gom is currently offline  Brad Gom
Messages: 49
Registered: August 1997
Member
If you specifically want to write a file for use in Excel, then its best to
write a text file where the values are seperated with commas (a CSV file). You
can use the PRINTF procedure to write formated text to a file, or WRITEU to
write binary data.

for example:

data=findgen(10,5)
;Open LUN 1 for data.csv with write access.
OPENW, 1, 'data.csv'
;Do the output operation to the file.
PRINTF, 1, data,format='(9(f,","),f)'
;Close the file.
CLOSE, 1

This will print out the contents of the data array, seperated with commas. Look
at the FORMAT keyword in the help to see how it works.


Brad



Rachel wrote:

> Hi. I'm a fairly new user of IDL, and I was wondering if there is anyway to
> export IDL variables. For instance, if I've created an array in IDL and I'd
> like to graph it in Excel or some other graphing program is there any way to
> get the array to excel. Any suggestion would be greatly appreciated.
>
> Thanks,
>
> Rachel
Re: exporting data [message #20474 is a reply to message #20470] Wed, 21 June 2000 00:00 Go to previous message
Brad Gom is currently offline  Brad Gom
Messages: 49
Registered: August 1997
Member
If you specifically want to write a file for use in Excel, then its best to
write a text file where the values are seperated with commas (a CSV file). You
can use the PRINTF procedure to write formated text to a file, or WRITEU to
write binary data.

for example:

data=findgen(10,5)
;Open LUN 1 for hello.dat with write access.
OPENW, 1, 'data.csv'
;Do the output operation to the file.
PRINTF, 1, data,format='(9(f,","),f)'
;Close the file.
CLOSE, 1

This will print out the contents of the data array, seperated with commas. Look
at the FORMAT keyword in the help to see how it works.


Brad


Rachel wrote:

> Hi. I'm a fairly new user of IDL, and I was wondering if there is anyway to
> export IDL variables. For instance, if I've created an array in IDL and I'd
> like to graph it in Excel or some other graphing program is there any way to
> get the array to excel. Any suggestion would be greatly appreciated.
>
> Thanks,
>
> Rachel
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Creating a GIF file from a graphics window in IDL
Next Topic: exporting data

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

Current Time: Wed Oct 08 19:34:18 PDT 2025

Total time taken to generate the page: 0.00553 seconds