MATLAB: Direct-access binary files

binaryfiles

Hi,
I need to upload a dataset on MatLab for research purposes, and the best dataset I was able to find apparently is formatted as a direct access binary file, here it comes:
Data files are written as direct-access binary files.
Infofile description:
Row 1 longitude resolution (XSTEP)
Row 2 latitude resolution (YSTEP)
Row 3 number of rows (NROWS)
Row 4 number of columns (NCOLS)
Row 5 no data code (NODATA)
Row 6 longitude of the central point of the upper left grid box (ULXCUT)
Row 7 latitude of the central point of the upper left grid box (ULYCUT)
Row 8 record length in bytes (BANDROWBYTES)
Row 9 file name
Now, my question is extremely simple: How do I extract all the informations contained here in a table? With the current information I found online I wasn't able to do anything.

Best Answer

The .inf file appears to be a text file. Read the first 8 rows of it as numbers and assign to appropriate variables.
After that you would probably use https://www.mathworks.com/help/matlab/ref/multibandread.html multiband read. Offset would be 0. I suspect that precision is 'single'. Difficult to guess whether it is big-endian or little-endian. bands is probably 1. It is not immediately clear whether the data is in row-major order or column-major order so it is not clear whether you should use [nrows, ncols] or [ncols, nrows] as the size parameter.
I am not sure at the moment what the bandrowbytes would do for you... unless, that is, there are multiple bands
Can you show us a sample .inf file, and show us the size of the corresponding binary file?
My suspicion is that the "no data code" is the value that is stored in the file to indicate that no data is available at that location.
Related Question