About reading binary files

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

About reading binary files

Samuele Zampini
Dear Users,

I am new in the mailing list.

My question is: how can I read binary, with Octave? I followed the steps on this page, but I get wrong numbers.

Any idea?


Thanks,
Samuele


Reply | Threaded
Open this post in threaded view
|

Re: About reading binary files

Doug Stewart-4


On Wed, Oct 2, 2019 at 7:13 AM Samuele Zampini <[hidden email]> wrote:
Dear Users,

I am new in the mailing list.

My question is: how can I read binary, with Octave? I followed the steps on this page, but I get wrong numbers.

Any idea?


Thanks,
Samuele



did you use the arch parametre?

The optional argument arch is a string specifying the data format for the file. Valid values are

"native" or "n"

The format of the current machine.

"ieee-be" or "b"

IEEE big endian.

"ieee-le" or "l"

IEEE little endian.



--
DASCertificate for 206392



Reply | Threaded
Open this post in threaded view
|

Re: About reading binary files

Samuele Zampini
Thanks Doug,

I am going to dig deeply into this. If I will still have problems, can I share a file with you?

Samuele

On Wed, Oct 2, 2019 at 1:33 PM Doug Stewart <[hidden email]> wrote:


On Wed, Oct 2, 2019 at 7:13 AM Samuele Zampini <[hidden email]> wrote:
Dear Users,

I am new in the mailing list.

My question is: how can I read binary, with Octave? I followed the steps on this page, but I get wrong numbers.

Any idea?


Thanks,
Samuele



did you use the arch parametre?

The optional argument arch is a string specifying the data format for the file. Valid values are

"native" or "n"

The format of the current machine.

"ieee-be" or "b"

IEEE big endian.

"ieee-le" or "l"

IEEE little endian.



--
DASCertificate for 206392



Reply | Threaded
Open this post in threaded view
|

Re: About reading binary files

Doug Stewart-4


On Thu, Oct 3, 2019 at 2:20 AM Samuele Zampini <[hidden email]> wrote:
Thanks Doug,

I am going to dig deeply into this. If I will still have problems, can I share a file with you?

Samuele

yes
 
On Wed, Oct 2, 2019 at 1:33 PM Doug Stewart <[hidden email]> wrote:


On Wed, Oct 2, 2019 at 7:13 AM Samuele Zampini <[hidden email]> wrote:
Dear Users,

I am new in the mailing list.

My question is: how can I read binary, with Octave? I followed the steps on this page, but I get wrong numbers.

Any idea?


Thanks,
Samuele



did you use the arch parametre?

The optional argument arch is a string specifying the data format for the file. Valid values are

"native" or "n"

The format of the current machine.

"ieee-be" or "b"

IEEE big endian.

"ieee-le" or "l"

IEEE little endian.



--
DASCertificate for 206392



--
DASCertificate for 206392



Reply | Threaded
Open this post in threaded view
|

Re: About reading binary files

Samuele Zampini


On Thu, Oct 3, 2019 at 11:51 AM Doug Stewart <[hidden email]> wrote:


On Thu, Oct 3, 2019 at 2:20 AM Samuele Zampini <[hidden email]> wrote:
Thanks Doug,

I am going to dig deeply into this. If I will still have problems, can I share a file with you?

Samuele

yes


Hi Doug,
attached a bin file I am trying to read.

It should have 3 (or 4) columns and 1000 rows.

Thanks a lot,
Samuele






 
 
On Wed, Oct 2, 2019 at 1:33 PM Doug Stewart <[hidden email]> wrote:


On Wed, Oct 2, 2019 at 7:13 AM Samuele Zampini <[hidden email]> wrote:
Dear Users,

I am new in the mailing list.

My question is: how can I read binary, with Octave? I followed the steps on this page, but I get wrong numbers.

Any idea?


Thanks,
Samuele



did you use the arch parametre?

The optional argument arch is a string specifying the data format for the file. Valid values are

"native" or "n"

The format of the current machine.

"ieee-be" or "b"

IEEE big endian.

"ieee-le" or "l"

IEEE little endian.



--
DASCertificate for 206392



--
DASCertificate for 206392




test1.bin (8K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: About reading binary files

Doug Stewart-4


On Thu, Oct 3, 2019 at 10:49 AM Samuele Zampini <[hidden email]> wrote:


On Thu, Oct 3, 2019 at 11:51 AM Doug Stewart <[hidden email]> wrote:


On Thu, Oct 3, 2019 at 2:20 AM Samuele Zampini <[hidden email]> wrote:
Thanks Doug,

I am going to dig deeply into this. If I will still have problems, can I share a file with you?

Samuele

yes


Hi Doug,
attached a bin file I am trying to read.

It should have 3 (or 4) columns and 1000 rows.

Thanks a lot,
Samuele




 where did you get the file? I seems to have a header before the data.
Is it 8 bit data 16 bit etc. 
you have to know all these things before you try and read it in!



 


 
 
On Wed, Oct 2, 2019 at 1:33 PM Doug Stewart <[hidden email]> wrote:


On Wed, Oct 2, 2019 at 7:13 AM Samuele Zampini <[hidden email]> wrote:
Dear Users,

I am new in the mailing list.

My question is: how can I read binary, with Octave? I followed the steps on this page, but I get wrong numbers.

Any idea?


Thanks,
Samuele



did you use the arch parametre?

The optional argument arch is a string specifying the data format for the file. Valid values are

"native" or "n"

The format of the current machine.

"ieee-be" or "b"

IEEE big endian.

"ieee-le" or "l"

IEEE little endian.



--
DASCertificate for 206392



--
DASCertificate for 206392



--
DASCertificate for 206392



Reply | Threaded
Open this post in threaded view
|

Re: About reading binary files

Octave - General mailing list
In reply to this post by Samuele Zampini
On 10/3/19 10:48 AM, Samuele Zampini wrote:

attached a bin file I am trying to read.

It should have 3 (or 4) columns and 1000 rows.


You need to know something about the content of the file. It has 6074 bytes, so it's not just plain 1000 binary numbers.

There seems to be some sort of a binary header, followed by what could be 16-bit integers. 

The plot does look somehow reasonable :

plot(fread(fopen('test1.bin'),'int16'))

you can see artifacts from the header and then the data that looks like some sort of noisy measurement.

of course that plot interprets the data as a single column.

What are the expected values that you think should be in this file?