• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Anylinks to explain how binary files are saved???

So I have some data that I need to go through. Now I'm decent with Matlab...but Matlab isn't really coding.

so I'm trying to load up some binary files. I figured out how to use some commands in matlab (fseek, fread, fopen) however I can't get my data to look anything like what I'm expecting.

I think part of it might be because I don't fully understand the 'terminology'.

Each file, has "200 blocks in the following structure: uint32, double [50], double [50]"

I tried to read up on blocks...and from what I've learned, a block is a way to divide up a series of bytes evenly. But what do they mean when they say "200 blocks"?

What I do know is that the first 'value' (sorry if these are the wrong words) is a 32 bit unsigned integer, then I have 50 double values, and then I have another set of 50 double values.

So this is what I'm understanding thus far:
I need to read the first 200 blocks as a single 32 bit integer
I need to read the next 50 sets of 200 blocks as a double
I need to read the last 50 sets of 200 blocks as a double


Did I understand this correct? Does the phrase "read the first 200 blocks as a single 32 bit integer" even make sense?

Is there a link where I can understand this? I feel like I'm not getting the organization structure correctly...and if that is the case, I could probably be chopping up this data forever and still not get it right
 
Sounds like you have a unsigned integer (32 bit) followed by 2 seperate 50-element arrays of double-precision floating point numbers (64 bit maybe??).

Then repeat that pattern 200 times.

That's my interpretation of the instructions.

EDIT: In this case a "block" would be the series of data (uint32)(double[50])(double[50]). So you have:

(uint32)(double[50])(double[50])(uint32)(double[50])(double[50])(uint32)(double[50])(double[50])(uint32)(double[50])(double[50])(uint32)(double[50])(double[50])(uint32)(double[50])(double[50])(uint32)(double[50])(double[50])....etc
 
lol see I'm confused...

Each file should have ONLY

unsigned 32 bit integer, double [50], double [50]

not repeated at all
That is why i'm curious about blocks and how to understand it

so basically i'm expecting 101 different values


 
Originally posted by: magomago
246KB

actually, to be specific, 251652 bytes.

that is the first file...
the rest are

245kb 250,848 bytes

Well that's a little large for what you're thinking should be in there. So I'm thinking there's more in there 🙂.
 
Originally posted by: Markbnj
Originally posted by: magomago
246KB

actually, to be specific, 251652 bytes.

that is the first file...
the rest are

245kb 250,848 bytes

Well that's a little large for what you're thinking should be in there. So I'm thinking there's more in there 🙂.

Indeed you are right. The guy I was talking to had a different definition of 'block'. This is what caused so much confusion.

However, due to all the reading, I understand how to read from binary a LOT better now 😉 I'm pretty sure I can handle it without an issue =) Thank you all!

edit:

This is making me wanna pick up a book on learning Java (as I heard its a good language to jump from) =) But I already have little time so I don't know how I'd find the time to learn it 😱
 
Back
Top