how to read .grd file?

Hi all
I am tryoung to read/extract information from .grd file using the following function
once i run it, it show this error:
Error using matlab.internal.imagesci.netcdflib
The NetCDF library encountered an error during execution of 'open' function - 'Unknown file format (NC_ENOTNC)'.
Error in netcdf.open (line 67)
[varargout{:}] = matlab.internal.imagesci.netcdflib ( 'open', filename, varargin{1} );
Error in grdread2 (line 61)
ncid = netcdf.open(file, 'NC_NOWRITE');
Can anyone please help?
Thnaks

4 Commenti

Jeffrey Clark
Jeffrey Clark il 14 Set 2022
@Lilya, it doesn't appear that the grdread2 has been updated for recent MATLAB versions. Have you tried Surfer Grid import/export - File Exchange - MATLAB Central (mathworks.com)?
Thanks Jeffrey for your response.
I am trying it now and still having error
Index exceeds the number of array elements (0).
Error in grd_read_v2 (line 19)
aux=str2num(fgetl(grdfile)); nx=aux(1); ny=aux(2);
Jan
Jan il 15 Set 2022
@Lilya: It seems like your file is empty.
Jeffrey Clark
Jeffrey Clark il 15 Set 2022
Modificato: Jeffrey Clark il 15 Set 2022
@Lilya, did you create this file or are sure it originated from a mapping system using Golden Software's grid format? Could be another unrelated application like Photoshop. Use a binary editor to look at the first sector and see if there are readable identifications. Even if it is in Golden Software's grid format that apperently has ASCII and binary forms that may not be compatible with the platform you are using or either of these two readers you have tried.

Accedi per commentare.

Risposte (0)

Tag

Richiesto:

il 14 Set 2022

Modificato:

il 15 Set 2022

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by