File Exchange

image thumbnail


version (212 KB) by Cameron Sparr
Easily create a uniformly spaced bathymetric or topographic grid from point cloud data.


Updated 02 Nov 2011

View License

This script allows you to simply place your point cloud .xyz files into the 'indata' folder and then run the script and your output will be a uniformly spaced grid in .mat and .xyz formats.

Point cloud files DO NOT need to be uniformly spaced or provide full coverage of your domain. Point cloud files can be named ANYTHING, as long as they are in the 'indata' folder (and end in .xyz). You may also use as many point clouds as you want.

This file comes pre-loaded with two point clouds as demonstrations. If you run it without modification, it will create a grid of Palau.

% 1. download the full 'easy_grid' directory
% 2. leaving all directory structures the same, place your own point clouds
% in .xyz or .mat format in the 'indata' directory
% 3. Any point clouds that you want to omit can go in the 'omit'
% directory
% 4. specify your lat/lon bounds, output resolution, and output
% name below.
% 5. run create_grid.m and watch it work!
% 6. a log file will be created in the same directory as create_grid
% NOTE: if using a .mat file as input, it must contain only one matrix
% and it must be in point cloud format. ie, it must be organized
% into 3 columns for x, y, and z, respectively. The name of the
% matrix in the .mat file does not matter.

Cite As

Cameron Sparr (2020). easy_grid (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (1)

Good morning sir,
i am using your code but not able to get output. i placed my .mat file in indata drectry. while executing i am getting
""Error using fprintf
Invalid file identifier. Use fopen to generate a valid file identifier.
Error in create_grid (line 40)
fprintf(logfile, ['Prepared on: ', datestr(now),'\n']);"" could you pay attention & please resolve my errors.
Thank you sir,


code update did not go through..?

updated summary to coincide with .mat support

Added support for .mat files

MATLAB Release Compatibility
Created with R2011b
Compatible with any release
Platform Compatibility
Windows macOS Linux