Re: The concept of a record



qsc wrote:
....

write(12) U(:) will write all the values in U(:) as one record. ...

If I am correct in the statement above, then what will be the
structure of
the data file? Or put in another way, after writing the array into an
external data file, I load the data file using fread of matlab. The
function fread will produce a data matrix. What will be the shape of the
matrix?
Is it (1,N), or is it (N, 1), or something else?

The order of U(:) will be column-major of what U() was dimensioned for--for exchange to Matlab, this is convenient as Matlab is also row-major.

Where you have a problem is that if you OPEN the file in Fortran as UNFORMATTED there is some internal Fortran file record structure (in short, required to support Fortran operations like BACKSPACE) that Matlab's fread() is not expecting.

To write a file for the purpose, you need stream or so-called "binary" i/o. To achieve this depends on the compiler as it was not a standard facility until the '03 Standard.

Check your compiler documentation for details of transferring files to other systems--normally there will be an example of how to accomplish the task. If that fails, post the particular compiler and somebody here will undoubtedly know the proper incantation.

--
.



Relevant Pages

  • Re: Problems with CLAPACK SVD routines on OS X
    ... I wanted to run this code of yours (I have lapack libraries installed on ... but incomplete type ... So let us what warnings you get from your compiler and send an example ... data file as well and then I will try again. ...
    (sci.math.num-analysis)
  • Old Fortran version
    ... I have a very nasty problem. ... This data is then read by a Fortran program, ... It is believed that the compiler ran on a Norsk Data system. ... THIS IS PROBABLY A @DATA FILE ...
    (comp.lang.fortran)
  • Re: COBOL file dump...
    ... I think you're off by 1 in the location, since the D indicates minus (a C ... You might want to pick up a good book on COBOL, along with the compiler ... reference for the version that produced your data file. ... > In a file from a COBOL dump, which is in ASCII, one of the fields is ...
    (microsoft.public.sqlserver.programming)
  • Re: help for reading a binary file
    ... You can not expect to read unformatted files written by compiler X with ... Look at the data file with a file editor. ... non-data prefix bytes. ...
    (comp.lang.fortran)
  • Re: COMP-3 Questions
    ... COBOL compiler. ... receives a data file which is defined by a COBOL copybook, ... Cannot be done without knowing the compiler and/or knowing if the elementary ... You can dig up a little more info with these free downloads: ...
    (comp.lang.cobol)