[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: exporting data

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.