Re: The concept of a record
- From: Gordon Sande <g.sande@xxxxxxxxxxxxxxxx>
- Date: Wed, 30 Jan 2008 20:18:30 GMT
On 2008-01-30 15:37:16 -0400, qsc <qingshan.chen@xxxxxxxxx> said:
After reading Gordon and Klaus's replies, I came to the conclusion
that
write(12) U(:) will write all the values in U(:) as one record. But
the concept
of "line" doesn't apply here.
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?
I will soon find it out by experiments. But if someone can shed light
on
it beforehand, it is greatly appreciated.
Thank you!
The values that are in the record come one after the other.
The structure of (1,n) or (n,1) is an artifact of your program.
There will usually be some documentation on how the sequence
of values corresponds to your structure. RTFM (Read The Fine
(or F***ing accoding to some folks) Manual)!
In Fortran you will find a correspondence that says the first subscript
varies most rapidly. It only matters if there are several (like 2) subscripts.
Other languages might choose to vary the last subscript most rapidly.
Fortran is the oldest commonly used language so it should be treated
deferentially with its choice preferred notwithstanding the opinions
of some upstart newcomers.
In your example both structures lead to the same sequence of values.
So the answer it is both! If you had some other value than 1 the answer
would be something else. But you may find that MatLab does not understand
Fortran records.
A common Fortran implementation of its record structure is to include
record lengths at the begining of the record, to allow forward skipping,
and the end, to allow backspacing. Without this implementation overhead
the useful operations of skipping and backspacing become much more difficult.
If you have never thought of these features your could end up expressing
wonderment, and your own lack of breadth of knowledge, at the need for this
overhead. If you know of these feature you are left wondering why other
systems are so primitive and devoid of capability.
.
- Follow-Ups:
- Re: The concept of a record
- From: qsc
- 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: Allocatable Arrays As Outputs
- 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
|
|