Direct-access binary files
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Mattia Albertini
am 8 Mär. 2020
Kommentiert: Walter Roberson
am 9 Mär. 2020
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.
3 Kommentare
Walter Roberson
am 8 Mär. 2020
To confirm, the .inf file is a text file that describes the corresponding file that does not have an extension?
Akzeptierte Antwort
Walter Roberson
am 8 Mär. 2020
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.
2 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!