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

Home » Public Forums » archive » Re: Extracting arrays into txt files
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Extracting arrays into txt files [message #46072 is a reply to message #46071] Thu, 03 November 2005 03:19 Go to previous messageGo to previous message
Peter Clinch is currently offline  Peter Clinch
Messages: 98
Registered: April 1996
Member
txominhermos@hotmail.com wrote:

> I would like to know how to extract a full array into a txt file,
> maintaining the samples and collums format, to export it to a excel
> file or similar.

Programs like Excel can read ASCII text okay so as long as your array is
printed out with some sort of commonly used text separator (like white
space) there shouldn't be any problem.

You can do this very easily from IDL with PRINTF, so something like

array=indgen(10,10) ; here is an array you can use as a test
openw,1,'idl.txt' ; open a file for writing
printf,1,array ; write the array to the text file
close,1 ; close the file

If you open idl.txt in notepad or similar you'll see a plain text
representation of your array in rows and columns. If you use File |
Open in Excel it will ask you a couple of questions about the format but
it will have a correct guess so you can just go with the defaults, and
then your array will be in row and column format.

That's for 1 and 2d arrays. Obviously Excel won't be able to deal with
higher dimensional data quite as easily as IDL...

Pete.
--
Peter Clinch Medical Physics IT Officer
Tel 44 1382 660111 ext. 33637 Univ. of Dundee, Ninewells Hospital
Fax 44 1382 640177 Dundee DD1 9SY Scotland UK
net p.j.clinch@dundee.ac.uk http://www.dundee.ac.uk/~pjclinch/
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: reading wav files
Next Topic: Re: online help IDL 6.2

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

Current Time: Fri Oct 10 01:57:59 PDT 2025

Total time taken to generate the page: 1.68103 seconds