.TH r.out.mat 1grass "" "GRASS 6.4.4" "Grass User's Manual" .SH NAME \fI\fBr.out.mat\fR\fR - Exports a GRASS raster to a binary MAT-File. .SH KEYWORDS raster, export .SH SYNOPSIS \fBr.out.mat\fR .br \fBr.out.mat help\fR .br \fBr.out.mat\fR [\-\fBv\fR] \fBinput\fR=\fIname\fR \fBoutput\fR=\fIstring\fR [\-\-\fBverbose\fR] [\-\-\fBquiet\fR] .SS Flags: .IP "\fB\-v\fR" 4m .br Verbose mode .IP "\fB\-\-verbose\fR" 4m .br Verbose module output .IP "\fB\-\-quiet\fR" 4m .br Quiet module output .PP .SS Parameters: .IP "\fBinput\fR=\fIname\fR" 4m .br Name of input raster map .IP "\fBoutput\fR=\fIstring\fR" 4m .br Name for the output binary MAT-File .PP .SH DESCRIPTION \fIr.out.mat\fR will export a GRASS raster map to a MAT-File which can be loaded into Matlab or Octave for plotting or further analysis. Attributes such as map title and bounds will also be exported into additional array variables. .br .br Specifically, the following array variables are created: .br .RE \fB map_data\fR \fB map_name\fR \fB map_title\fR (if it exists) \fB map_northern_edge\fR \fB map_southern_edge\fR \fB map_eastern_edge\fR \fB map_western_edge\fR .RE .br In addition, \fIr.out.mat\fR makes for a nice binary container format for transferring georeferenced maps around, even if you don't use Matlab or Octave. .SH NOTES \fIr.out.mat\fR exports a Version 4 MAT-File. These files should successfully load into more modern versions of Matlab and Octave without any problems. .br Everything should be Endian safe, so the resultant file can be simply copied between different system architectures without binary translation. .br As there is no IEEE value for NaN for integer maps, GRASS's null value is used to represent it within these maps. You'll have to do something like this to clean them once the map is loaded into Matlab: \fC .DS map_data(find(map_data < -1e9)) = NaN; .DE \fR .br .br Null values in maps containing either floating point or double-precision .br floating point data should translate into NaN values as expected. .br .br .br .br .br .br \fIr.out.mat\fR must load the entire map into memory before writing, .br therefore it might have problems with \fIhuge\fR maps. .br (a 3000x4000 DCELL map uses about 100mb RAM) .br .br .br .br GRASS defines its map bounds at the outer-edge of the bounding cells, not at .br the coordinates of their centroids. Thus, the following Matlab commands may .br be used to determine the map's resolution information: .br \fC .DS .br [rows cols] = size(map_data) .br x_range = map_eastern_edge - map_western_edge .br y_range = map_northern_edge - map_southern_edge .br ns_res = y_range/rows .br ew_res = x_range/cols .br .DE \fR .br .SH EXAMPLE In Matlab, plot with either: \fC .DS .br imagesc(map_data), axis equal, axis tight, colorbar .br .DE \fR or \fC .DS .br contourf(map_data, 24), axis ij, axis equal, axis tight, colorbar .br .DE \fR .br .SH TODO Add support for exporting map history, category information, color map, etc. .br Option to export as a version 5 MAT-File, with map and support information stored in a single structured array. .SH SEE ALSO \fI r.in.mat .br r.out.bin .br r.null .br The Octave project \fR .SH AUTHOR Hamish Bowman .br \fI Department of Marine Science .br University of Otago .br New Zealand\fR .br .br .PP \fILast changed: $Date: 2011-11-08 12:29:50 +0100 (Tue, 08 Nov 2011) $\fR .PP Full index .PP © 2003-2014 GRASS Development Team