> Date: Wed, 5 Feb 2003 13:18:24 -0500
> To: [log in to unmask]
> Hello,
>
> I found the following program 1 and 2 give different binary files.
> Could anyone explain why? I compared the two binary files
> and find that test.out2 has 8 bytes more in the middle and the first
> 4 bytes and last 4 bytes of the two files are also different.
>
> Related with this, I have a binary file produced by
> write(11) A
>
> Can I read it in column by column in a different code by doing
> read(11)A(:,1)
> read(11)A(:,2)
No, you cannot do that, because the output is binary.
Binary output must be read in the same way as it as written,
because extra bytes are written at the beginning and end of
each record.
However, if you write the array a column at a time, you will be able
to read in the array a column at a time.
If the array is already written out as an entire array,
do a short program to read in the whole array, and write it out again
(writing each column separately), and use that.
> The need for doing this comes when A is a huge array, and I only need it
> one column at a time.
>
> Thanks for your help
>
> Xiaogang
> ------------------------------------------------
> Dr Xiaogang Wang
|