This function saves a spatial matrix into an Arc-Info ascii raster. Two file extension '.asc' or '.txt' are supported.
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.
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.
Hi, Thank you for your function. I downloaded ImprtAsciiRaster function and created Z and h. Then I made some changes in values of Z. Then I wrote SaveAsciiRaster('Z','h'). but I got the error ( Warning: Input should be a string. ). What is my problem? Thank you.
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.
Line 69: uiputfile
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.
An xyz matrix can now be saved using
Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.