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 #33862 is a reply to message #33861] Thu, 30 January 2003 08:37 Go to previous messageGo to previous message
James Kuyper is currently offline  James Kuyper
Messages: 425
Registered: March 2000
Senior Member
Murat Maga wrote:
>
> Hi All,
> 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?
> Best,
> Murat

I presume that this file is being written in ASCII rather than binary
format for portability reasons, and not for human readability. When a
single line of the matrix contains a thousand or more elements, it's a
pretty safe bet that humans won't be reading it. I've never heard of a
display devise big enough to display a single row of that matrix all on
one line.

That being the case, why do you care where it breaks the line? It's easy
enough to write code that reads the file in a way that treats the
newline characters the same as other whitespace characters. That's true
not only in IDL, and also in several other languages that I know.

However, if you do indeed want to do this, print/printf does indeed seem
to be the way to go. The only "tricks" I'm aware of are repeat counts
and format reversion:

array = fltarr(2000,1000)
readf,infile,array
printf,outfile,'$(2000F)', array

These feel like tricks to someone coming from a C background; but for
Fortran programmers it seems quite normal.
[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 20:01:22 PDT 2025

Total time taken to generate the page: 0.47971 seconds