5.0

5.0 | 1 rating Rate this file 21 Downloads (last 30 days) File Size: 2.81 KB File ID: #24442

Save ascii raster

by

 

15 Jun 2009 (Updated )

Save a MatLab array in a typical ArcInfo ascii raster, with header at top.

| Watch this File

File Information
Description

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.

MATLAB release MATLAB 7.4 (R2007a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (3)
10 Mar 2014 Lukas

Fine submission, however output files didn't work in Wasp Engineering software because different line ends. To fix I transcribed '\n' to char([13,10]) in the code.

26 Apr 2010 Giuliano Langella

Line 69: uiputfile

26 Apr 2010 Miga Magenika Julian

in which line if i want to save the ascii files manually not automatic? because i want to put a header information in many data.

thank you

Updates
02 Feb 2010

An xyz matrix can now be saved using
SaveAsciiRaster(xyz);

Contact us