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

Home » Public Forums » archive » Re: Writing in text 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: Writing in text file [message #72694 is a reply to message #72693] Mon, 27 September 2010 04:48 Go to previous messageGo to previous message
d.poreh is currently offline  d.poreh
Messages: 406
Registered: October 2007
Senior Member
On Sep 27, 4:16 am, Ben Tupper <ben.bigh...@gmail.com> wrote:
> On 9/27/10 5:05 AM, Dave Poreh wrote:
>
>
>
>
>
>> Folks
>> Hi;
>> I read some data like this:
>> -1.8750000000 78.8750000000 1.317
>> -1.8750000000 78.6250000000 1.284
>> -1.8750000000 78.3750000000 1.216
>> -1.8750000000 78.1250000000 1.148
>> -1.8750000000 77.8750000000 1.080
>> ………………………………
>> And when I want to write it,
>> openw,1,'C.dat'
>> z=transpose(reform([data[0,*],data[1,*],data[2,*]],n_element s(data[2,*]),
>> 3))
>> printf,1,z
>> close,1
>> it gives me something like this:
>>       -1.87500     0.897000      71.6250
>>        78.8750      9.87500     0.645000
>>        1.31700      70.3750      21.8750
>>       -1.87500      1.01300      71.3750
>>        78.6250      9.87500     0.538000
>>        1.28400      70.1250      21.8750
>>               ……….
>> Will you please help me out whit this?
>> Cheers
>> Dave
>
> Hi Dave,
>
> You haven't said what you expected to see, but clearly the transpose is
> making this come out 'funny'.  Here's what I see when I simply readf
> from a file ("data-int.txt") and then printf the data to a file
> ("data-out.txt").
>
> Cheers,
> Ben
> { x86_64 darwin unix Mac OS X 7.1 Apr 21 2009      64      64}
>
> ;data-in.txt looks like the following
>
> ;-1.8750000000 78.8750000000 1.317
> ;-1.8750000000 78.6250000000 1.284
> ;-1.8750000000 78.3750000000 1.216
> ;-1.8750000000 78.1250000000 1.148
> ;-1.8750000000 77.8750000000 1.080
>
> infile = "data-in.txt"
> n = FILE_LINES(infile)
> s = FLTARR(3, n)
> OPENR, U, infile, /GET_LUN
> READF, U, s
> FREE_LUN, u
>
> outfile = "data-out.txt"
> OPENW,U, outfile,/GET_LUN
> PRINTF, U, s
> FREE_LUN, U
>
> ; data-out.txt looks like the following
>
> ;     -1.87500      78.8750      1.31700
> ;     -1.87500      78.6250      1.28400
> ;     -1.87500      78.3750      1.21600
> ;     -1.87500      78.1250      1.14800
> ;     -1.87500      77.8750      1.08000

Thanks Ben. You r way is perfect. I don’t know why my way does not
working?
Cheers
Dave
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: IDL 8 Display Updating Question
Next Topic: Re: IDL 8 Display Updating Question

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

Current Time: Fri Oct 10 13:39:27 PDT 2025

Total time taken to generate the page: 0.31819 seconds