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

Home » Public Forums » archive » Re: problem with reading formated file
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: problem with reading formated file [message #10154 is a reply to message #10137] Sat, 11 October 1997 00:00 Go to previous messageGo to previous message
rivers is currently offline  rivers
Messages: 228
Registered: March 1991
Senior Member
In article <343f0158.1848870@news-server>, ccampo1@nospamsan.nospamrr.com (Chris and Cathy Campo) writes:
> On Fri, 10 Oct 1997 19:25:54 +0300, Pavel Eiges <eiges@chat.ru> wrote:
>> i have a formated file like this:
>> ===========================
>> 1877383765 1.778
>> 1877384765 1.685
>> 1877385765 1.599
>> 1877386765 1.599
>> 1877387765 1.685
>> ===========================
>> and i need to load it into two arrays. the first array is LONG-type,
>> the second one - FLOAT-type. How i can do this?
>> ("READF, file, Time, Data" does not work).
>
>
> try this:
> n=5
> time = lonarr(n)
> data = fltarr(n)
> for i = 0, n-1 do begin
> readf,file, time(i), data(i)
> endfor

No, this will not work!!! You cannot read into a subscripted array element,
because time(i) is passed by "value" rather by "reference" to readf.

The simplest way to solve the problem is as follows:

n=5
time = lonarr(n)
data = fltarr(n)
temp = fltarr(2, n)
readf, file, temp
time(*) = temp(0,*)
data(*) = temp(1,*)

____________________________________________________________
Mark Rivers (773) 702-2279 (office)
CARS (773) 702-9951 (secretary)
Univ. of Chicago (773) 702-5454 (FAX)
5640 S. Ellis Ave. (708) 922-0499 (home)
Chicago, IL 60637 rivers@cars.uchicago.edu (e-mail)

or:
Argonne National Laboratory (630) 252-0422 (office)
Building 434A (630) 252-0405 (lab)
9700 South Cass Avenue (630) 252-1713 (beamline)
Argonne, IL 60439 (630) 252-0443 (FAX)
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: widget_control,draw_widget
Next Topic: open windows with IDL on two monitors?

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

Current Time: Wed Oct 08 19:36:43 PDT 2025

Total time taken to generate the page: 0.00409 seconds