Re: The concept of a record
- From: dpb <none@xxxxxxx>
- Date: Wed, 30 Jan 2008 13:57:08 -0600
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.
--
.
- Follow-Ups:
- Re: The concept of a record
- From: qsc
- Re: The concept of a record
- From: dpb
- Re: The concept of a record
- References:
- The concept of a record
- From: qsc
- Re: The concept of a record
- From: Klaus Wacker
- Re: The concept of a record
- From: qsc
- The concept of a record
- Prev by Date: Re: The concept of a record
- Next by Date: Re: The concept of a record
- Previous by thread: Re: The concept of a record
- Next by thread: Re: The concept of a record
- Index(es):
Relevant Pages
|
|