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

Home » Public Forums » archive » Re: formatting array output?
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: formatting array output? [message #33844] Fri, 31 January 2003 08:41 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Murat Maga (maga@mail.utexas.edu) writes:

> I have an integer array (2000x1000) which I would like to write in file
> in the typical matrix convention. I think IDL breaks the line at 80th
> column and everything starts to look quite messy.
> To format an array output, do I use the print/printf, or are there any
> other tricks good to know?

Years ago, before all of us were born (circa 1875), computer
programs weren't written in a text editor. They were written
on punch cards. You hammered away at a big typewriter-like
console with really big keys. You had to slam them pretty good,
because the arms of the keys had to punch a chad out of the
card. Hanging chads were quite a serious problem in those
days (I.e., it wasn't just the future of our country that
depended upon it, it was an extra day or two running back
and forth to the computer center that was at stake!).

Anyway, those cards had 80 columns and the number 80
has been indelibly imprinted on computer operations
ever since. If you want your output "line" to have,
say, 20000 columns (suitable for 2000 values, each
having a width of 10 characters), you would use the
WIDTH keyword when you open the file:

OPENW, 1, 'myfile.txt', Width=20000

Now you can put your data into the file in the way
you like:

FOR j=0,999 DO PRINTF, 1, data[*,j], Format='(I10)'

When you look at it in a text editor, however, you might
find that the editor word-wraps at 80 characters. :-(

Cheers,

David
--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: last array index subscript
Next Topic: Re: Alpha Blending inside of Widgets / Graphic Objects in Widgets

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

Current Time: Fri Oct 10 10:20:35 PDT 2025

Total time taken to generate the page: 1.92258 seconds