Save ascii raster
This function saves a spatial matrix into an Arc-Info ascii raster. Two file extension '.asc' or '.txt' are supported.
FIRST CASE
USE: SaveAsciiRaster(varname, header);
It requires two inputs: (1) the z-values to be exported ('varname' variable), and (2) the 'header' vector with the spatial information of the grid. 'varname' can be a 1-D vector or a 2-D spatial grid.
SECOND CASE
USE: SaveAsciiRaster(varname);
If an xyz matrix (with [x_coord,y_coord,z_values]) is given as 'varname', no 'header' has to be defined, since the function will extract all the required header information from the xyz table. The first row contains the x_coord, y_coord and z_value of the most north-western cell; the last row refers to the most south-eastern pixel. Elements in xyz are sorted column-by-column from the geographical grid (geographical_grid=[1st_col,2nd_col,3rd_col,...,last_col]; xyz=[1st_col;2nd_col;3rd_col;...;last_col]).
The xy coordinates have to refer to the center of the cells.
Cite As
Giuliano Langella (2024). Save ascii raster (https://www.mathworks.com/matlabcentral/fileexchange/24442-save-ascii-raster), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.