Why can the binary file not be opened?
11 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello!
I am trying to open data from a binary file, but fopen gives -1 (which apparently means that some error occurred). So, what could this mean?
You can actually find a description of my data and the file online, which might be more helpful than my poor description of the data, as I am new to programming. Here is the link to download the data: http://glcf.umd.edu/data/ndvi/ and below, you find the description. Thanks for all advice!
So here is the description of the three files which I'd like to load:
- Projection: Sinusoidal - reprojected from Integerized Sinusoidal - Central Meridian used was 55d00'0.0" W (central latitude of 0d)
- There are three data files: 1 contains the NDVI, the other two contain the MODIS bands 1 and 2 respectively
- Image Size: 14819 Pixels x 8896 Lines
- Upper Left Corner: 73.31578801563607d W 0.001124150740324725d N (UL -2036621.843 E 125.00 N meters)
- Lower Right Corner: 39.03545054942156 W 19.99976582111718d S (LR 1668122.392 E -2223871.446 N meters)
- Corner points in meters are relative to the point 55d' W 0d. If your software has a different default central latitude you may need to apply a false northing.
- As a result of the native I-sin grid there may be shift of up to 1 pixelin the latitude range 0 - 8 degrees South. This issue is currently beingaddressed and the data will be replaced when it is resolved.
- There are three data files: - 1 NDVI file: SA...NDVI.bin - 2 Band files: SA...Band"n".bin (where "n" is either 1 or 2)
- Data format for the NDVI file is binary with 8 bit Unsigned integer
- Data format for the Band files is binary with 16 bit Unsigned integer
- A bitmap was applied to mask out the shallow water along the coastlinesand in Lake Titicaca
- NDVI scaling: - To obtain the actual NDVI value from the Dn (digital number) use the following formula: (Dn - 128) / 100 = NDVI
- A full description of the compositing procedure will be available as a link from the product description page on the website. http://glcf.umiacs.umd.edu/MODIS/product.htm_
2 comentarios
Subin Kuttappan Stellal Mary
el 12 de Feb. de 2016
I am able to open the file SA.NDVI_QKM.GLCF.2000273.sinus.band2.bin downloaded from the link, using the fopen function.
Following is the command I used to open the file. The file is present in my current MATLAB folder:
>> fileID = fopen('SA.NDVI_QKM.GLCF.2000273.sinus.band2.bin','r')
fileID =
4
>> A = fread(fileID);
I got A as a 289144475x1 vector.
For checking what is the issue at your side, provide the following info:
1) What are the commands you used?
2) Is the file path proper?
Respuestas (1)
Image Analyst
el 9 de Jul. de 2016
It could be you had already opened it, then stopped your script for some reason and then tried to open it again. Or some other program might have put a lock on it because the other program had the file open.
0 comentarios
Ver también
Categorías
Más información sobre MATLAB Support for MinGW-w64 C/C++ Compiler en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!