Thread Subject: How can i read a binary file?

Subject: How can i read a binary file?

From: Orcun Kor

Date: 31 Oct, 2009 12:15:20

Message: 1 of 4

Hi all,

I'm trying to read my binary file "data.W0021" which is composed of data like:

0.0000000 -0.14310697
0.0010000 -0.16618958
0.0020000 -0.17370732

i use fopen and fread commands and can manage to import datas, but what i really need is, to get a matrix like that, which i cannot get:

[ 0.0000000 -0.14310697
    0.0010000 -0.16618958
    0.0020000 -0.17370732 ]

Can anybody help me?

Subject: How can i read a binary file?

From: Lothar Schmidt

Date: 31 Oct, 2009 12:27:22

Message: 2 of 4

Orcun Kor schrieb:
> Hi all,
>
> I'm trying to read my binary file "data.W0021" which is composed of data like:
>
> 0.0000000 -0.14310697
> 0.0010000 -0.16618958
> 0.0020000 -0.17370732
>
> i use fopen and fread commands and can manage to import datas, but what i really need is, to get a matrix like that, which i cannot get:
>
> [ 0.0000000 -0.14310697
> 0.0010000 -0.16618958
> 0.0020000 -0.17370732 ]
>
> Can anybody help me?

you will easily find out how the data is organized in your binary file.
Just use this knowledge to sort and arrange the data in the way you want
it to be represented.

Subject: How can i read a binary file?

From: HongXiang

Date: 31 Oct, 2009 13:37:02

Message: 3 of 4

"Orcun Kor" <orcunkor@gmail.com> wrote in message <hch9oo$l1p$1@fred.mathworks.com>...
> Hi all,
>
> I'm trying to read my binary file "data.W0021" which is composed of data like:
>
> 0.0000000 -0.14310697
> 0.0010000 -0.16618958
> 0.0020000 -0.17370732
>
> i use fopen and fread commands and can manage to import datas, but what i really need is, to get a matrix like that, which i cannot get:
>
> [ 0.0000000 -0.14310697
> 0.0010000 -0.16618958
> 0.0020000 -0.17370732 ]
>
> Can anybody help me?

A = (fscanf(fopen('data.w0021','%f',[2,3]))';

Subject: How can i read a binary file?

From: HongXiang

Date: 31 Oct, 2009 15:22:01

Message: 4 of 4

Sorry, I have missed one parenthesis. It should be
A = (fscanf(fopen('data.w0021'), '%g', [3,2]))';

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
binary file Orcun Kor 31 Oct, 2009 08:19:03
fopen Orcun Kor 31 Oct, 2009 08:19:03
fread Orcun Kor 31 Oct, 2009 08:19:02
rssFeed for this Thread

Contact us at files@mathworks.com