Re: The concept of a record



On 2008-01-30 22:08:49 -0400, qsc <qingshan.chen@xxxxxxxxx> said:

On Jan 30, 3:18 pm, Gordon Sande <g.sa...@xxxxxxxxxxxxxxxx> wrote:

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.


Hi Gordon,
I know this part of knowledge about Fortran. My question should have
been put this way: with X written out as in the example, what shape
would it be of the matrix A = fread(fid)? Here fread is the matlab
command. For a matrix in matlab, the shape (n,1) and (1,n) look
visually differently, although internally they may both be stored as a
sequence of numbers in the memory. It turns out that the matrix has
the shape (n,1).

You are right to notice that they are different visually and that the
difference may not matter for the internal storage. Likewise for the
external storage.

A Fortran newsgroup is not a good place to ask about MatLab. Some folks
here may know about Matlab but most do not. Much better to try someplace
like comp.soft-sys.matlab which shows up in the list of newsgroups when
I do a search of them for matlab. The folks there are much more likely
to know about the foibles of file input to MatLab.

MatLab presumably has a manual and you should RTFM! Funny facts like dealing
with storage are what manuals are all about. Boring as hades but bloody
useful when you actually need to do something. If you can find an electronic
copy you might even use an apropriate find command to locate relevant sections
assuming you can guess good keywords.



.



Relevant Pages

  • Re: The concept of a record
    ... In Fortran you will find a correspondence that says the first subscript ... Other languages might choose to vary the last subscript most rapidly. ... In your example both structures lead to the same sequence of values. ... But you may find that MatLab does not understand ...
    (comp.lang.fortran)
  • Re: MATLAB <-> FORTRAN
    ... When you do A\b it just calls the basic solvers Matlab knows, ... in some cases Gauss Elimination. ... In this case you can find a Gauss Solver, ... I've bitten the bullet and converted to Fortran ...
    (comp.soft-sys.matlab)
  • Re: Matlab Vectorisation Speed - How is it done in c++?
    ... Beating the performance of vectorized Matlab code is very ... Matlab makes calls to optimized C and Fortran libraries ... Use optimization level 3 on numerical code and level 2 on non- ...
    (comp.soft-sys.matlab)
  • Re: Calling MATLAB from Fortran
    ... Fortran saves the data which Matlab m-file needs and then Matlab would read them as input from the file and after calculation save then in a file for Fortran. ... returns mxArray * ...
    (comp.soft-sys.matlab)
  • Re: pass 1D vector from matlab to fortran
    ... matlab to fortran: ... %input: timeseries ts and constants ... polynomial in seasonal smoothing ...
    (comp.soft-sys.matlab)