MATLAB: How to skip header consit of integer words

freadskip header

The file I am trying to read has following description: The files were written in IEEE binary (big-endian). Each file contains three records described as follows:
rec 1: date and version number (8 4-byte integer words)
rec 2: gridded sst values in degC (360*180 4-byte real words)
rec 3: gridded ice concentration (360*180 1-byte integer words)
How can I read rec 2 and rec 3 data without worrying about the rec 1? I've tried using fseek but it's not working. For rec 2 I am using something like: sst=fread(fid2,[360,200],'real*4',1,'ieee-be'); but I am getting all crazy nos which doesn't make any sense.
Thanks.

Best Answer

fid=fopen('file','r','ieee-be');
fseek(fid,8*4);
temp=fread(fid,[360,180],'real*4','ieee-be').'; % no skip and fix size and orientation
ice=fread(fid,[360,180],'real*4','ieee-be').';
fid=fclose(fid);
Certainly after the first value skipping a byte will really screw everything after up until get thru the cycle of four bytes at which you should get one correct value again. Also remember Matlab fills the array in column-major order.
If after the above, data don't look like real floating point values, I'd suspect native format as the option.
Related Question