Surfer Grid import/export
라이선스 없음
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
인용 양식
Alberto Avila Armella (2024). Surfer Grid import/export (https://www.mathworks.com/matlabcentral/fileexchange/20880-surfer-grid-import-export), MATLAB Central File Exchange. 검색됨 .
MATLAB 릴리스 호환 정보
플랫폼 호환성
Windows macOS Linux카테고리
- Mathematics and Optimization > Mapping Toolbox > Data Import and Export >
- Radar > Mapping Toolbox > Data Import and Export >
태그
도움
줌: xyz2grd
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!