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

Home » Public Forums » archive » Re: Saving array into column formatted text file
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: Saving array into column formatted text file [message #8721] Wed, 16 April 1997 00:00
Jim O'connor is currently offline  Jim O'connor
Messages: 7
Registered: March 1996
Junior Member
> Mila Mitra wrote:
>
> I have IDL arrays, that I would like to write out to a text file
> so that it retains the dimensionality in the form of rows and
> columns.
>
Here's a simple way:

Wave > rm,a,2,3 # Read a 2x3 matrix (from the command line)
row 0: 1 2 3 # or you could say
row 1: 4 5 6 # a = transpose([ [1,2,3],[4,5,6]])
Wave > pm,a # print the matrix on stdout
1.00000 2.00000 3.00000
4.00000 5.00000 6.00000

# The next three lines write the matrix to a file:
Wave > openw, outunit,'/tmp/tmp.sav',/Get_Lun
Wave > pmf, outunit, a # print matrix to file
Wave > close,outunit

Wave > $ cat /tmp/tmp.sav
1.00000 2.00000 3.00000
4.00000 5.00000 6.00000

You can read the file in with rmf. Rm, rmf, pm and pmf
are standard functions in Wave.

You may want to transpose a pre-existing array, since
these functions use matrixname(row_index,column_index),
while Wave normally assumes arrayname(column_index,row_index); e.g.
Wave > pm,a(0,*)
1.00000 2.00000 3.00000
Wave > print,transpose(a(0,*))
1.00000 2.00000 3.00000


--

Jim
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: variable # of widgets
Next Topic: idl for linux on notebooks

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

Current Time: Sat Oct 11 04:13:41 PDT 2025

Total time taken to generate the page: 1.36206 seconds