Sie verfolgen jetzt diese Einreichung
- Aktualisierungen können Sie in Ihrem Feed verfolgter Inhalte sehen.
- Je nach Ihren Kommunikationseinstellungen können Sie auch E-Mails erhalten.
Surfer Grid, import/export.
Matlab <-> Golden Software Surfer and Grapher
The pack contains two simple routines: grd_write.m and grd_read.m. They communicate Matlab with Golden Software Surfer by the GRD file format (ASCII version).
grd_write(matrix,xmin,xmax,ymin,ymax,namefile)
Input:
matrix = matrix to export
xmin,xmax,ymin,ymax = grid limits
namefile = name of the file to be written (include ".grd" extension)
Output:
grd file in current directory
[matrix xmin xmax ymin ymax]=grd_read(name of file)
Input:
nomarch = name of the file to be read, including ".grd" extension
Output:
matrix = matrix of the read data
xmin xmax ymin ymax = grid limits
* NOTE: Previous version of grd_read worked only with files saved in Surfer (or Grapher), but now is SOLVED. It runs faster also.
Example of use:
Creation of a matrix in Matlab:
x=linspace(-4,4,100);
y=linspace(-5,5,100);
[X,Y]=meshgrid(x,y);
Z=cos(sqrt(X.^2+Y.^2));
Export to surfer:
grd_write(Z,min(x),max(x),min(y),max(y),'example.grd')
Open in surfer and save as:
Open example.grd in Surfer (as a grid: file-> open). Then save it, for example with the name example_saved_by_surfer.grd. Remember to chose “GS ASCII (*.grd)”.
Load the saved file in Matlab
[matrix xmin xmax ymin ymax]=grd_read('example_saved_by_surfer.grd');
---Coded by Alberto Avila Armella, updated and improved by Jose Maria Garcia-Valdecasas
Zitieren als
Alberto Avila Armella (2026). Surfer Grid import/export (https://de.mathworks.com/matlabcentral/fileexchange/20880-surfer-grid-import-export), MATLAB Central File Exchange. Abgerufen .
Quellenangaben
Inspiriert: xyz2grd
Allgemeine Informationen
- Version 1.1.0.0 (1,18 KB)
-
Keine Lizenz
Kompatibilität der MATLAB-Version
- Kompatibel mit allen Versionen
Plattform-Kompatibilität
- Windows
- macOS
- Linux
| Version | Veröffentlicht | Versionshinweise | Action |
|---|---|---|---|
| 1.1.0.0 | Previous version of grd_read worked only with files saved in Surfer (or Grapher), but now is SOLVED (by Jose Maria Garcia-Valdecasas). It runs faster also. |
||
| 1.0.0.0 |
