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

Home » Public Forums » archive » Re: Read & write data files b/w IDL & Fortran 90
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: Read & write data files b/w IDL & Fortran 90 [message #39060 is a reply to message #39051] Thu, 08 April 2004 14:45 Go to previous messageGo to previous message
Paul Van Delst[1] is currently offline  Paul Van Delst[1]
Messages: 1157
Registered: April 2002
Senior Member
bridgemat wrote:
> As someone who knows just the basics of IDL and the basics plus a bit
> more of Fortran 90, I'm sure this is just some rookie mistake, so
> hopefully someone out there can help me out.
>
> I'm trying to write an idl array to a file, read the file in Fortran
> 90, manipulate the Fortran array, and then write that new array to a
> file that I then read into IDL. Here's how I write the original array
> to a file:
>
> test=indgen(3,4,5)
> openw,lun,'testidl.dat',/get_lun
> writeu,lun,test
> free_lun,lun

Hello,

You need to use the /f77_unformatted keyword on the IDL open. This will stick the 4-byte
delimiter at the beginning and end of each output record. Alternatively, you can specify
direct access with a set record length in your f90 OPEN statement.

> Another issue: array dimensions! My IDL book tells me that both IDL
> and Fortran arrays are column-major. Although I've been using Fortran
> longer than IDL, I haven't done much w/ multi-dimensional arrays, so I
> looked in my Fortran book, and it says that Fortran is row-major!
> Ack!!! So does that mean my Fortran array should be declared as
> DIMENSION(5,4,3) in this case? I tried that, too, but got the same
> error...

No. Declare the IDL and Fortran arrays the same way. I can never remember what the hell
column- or row-major means. I just remember that IDL is same as Fortran, and C is the
opposite.

paulv
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: How to rebin complex array?
Next Topic: processor for idl on MoinMoin

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

Current Time: Thu Oct 09 23:19:25 PDT 2025

Total time taken to generate the page: 1.35921 seconds