Question

I have a data file that's in a binary double data format as far as I can tell goes like this:

[column1value1][column2value1][column1value2][column2value2]...etc

I have been able to look at the fread documentation and figure out how to extract column1's data by using skip. A double is 8 bytes long and I therefore assigned a skip value of 8. Here is my code:

fID = fopen('141518-10000-2.bin');
skip = 8;
A= fread(fID,'double',skip);
fclose(fID);

This returns me column 1 of the data into A. How do I offset this by one data point now to get column 2's data? Any help is much appreciated.

Était-ce utile?

La solution

To do the second column the same way, you can use fseek to go to the first value in column 2 and then continue with fread the same way you are doing:

fseek(fID,8,'bof');
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top