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

Home » Public Forums » archive » Re: counting elements in 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: counting elements in files [message #6613 is a reply to message #6609] Wed, 24 July 1996 00:00 Go to previous message
Andy Loughe is currently offline  Andy Loughe
Messages: 174
Registered: November 1995
Senior Member
Gideon Z Romm wrote:
>
> I have a file with a bunch of numbers stored in it, formatted. It looks
> something like this:
>
> 2555 3456 4567 5678 6789 7890
> 2345 6788 3445 6778 8899 9900
> ..
> ..
> ..
>
> I am having trouble finding a procedure that will count the number of
> elements in this file, so that when I create an array into which to read
> this file, I will know what size to make the array.
> Any suggestions?
>
> Gadi


If the number of columns is fixed, why not use... cat filename | wc -l
in an IDL spawn command, then multiply that by the number of columns
you know to be in the file.

Or, if you know the number of columns, you could use free formatted read
(as long as there commas, whitespace, or tabs) and use the while not eof
logic. That way you don't even need to know the total number of
elements in the file.

Does this help, or am I way out in left field?

--
Andrew F. Loughe afl@cdc.noaa.gov
University of Colorado, CIRES http://cdc.noaa.gov/~afl
Campus Box 449 phn:(303)492-0707 fax:(303)497-7013
Boulder, CO 80309-0449 "He who laughs last thinks slowest!"
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Foreign fonts and map boundary problems in IDL
Next Topic: MacPPC IDL 4.0: TYLCT bug?

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

Current Time: Sat Oct 11 00:54:31 PDT 2025

Total time taken to generate the page: 0.63994 seconds