View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from

4.0 | 1 rating Rate this file 8 Downloads (last 30 days) File Size: 2.69 KB File ID: #26290 Version: 1.1



Kelsey Jordahl (view profile)


06 Jan 2010 (Updated )

Uses built-in netCDF capability to write a grid file to be read by GMT (Generic Mapping Tools).

| Watch this File

File Information

GRDWRITE2(X,Y,Z,'file.grd') will create a grid file containing the data in the matrix Z. X and Y should be either vectors with dimensions that match the size of Z or two-component vectors containing the max and min values for each. The file will be a COARDS-compliant NetCDF file, the standard format for GMT version 4 and later.
Based on the compiled mexfile-based function grdwrite, part of the GMT supplemental packages.

For more information on GMT grid file formats, see:

GMT (Generic Mapping Tools) was developed by Paul Wessel and Walter H. F. Smith (



Grdread2 inspired this file.

MATLAB release MATLAB 7.9 (R2009b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (1)
17 Dec 2010 Donglai Gong

Need to update netcdf.create line in grdwrite2.m to work with R2010b. (i.e. the mode should be 'NC_SHARE' instead of 'NC_WRITE'). Otherwise work as advertised. Thanks!

19 Jul 2011 1.1

Change netcdf.create to use NC_SHARE option

Contact us