.TH r.in.mat 1grass "" "GRASS 6.4.4" "Grass User's Manual" .SH NAME \fI\fBr.in.mat\fR\fR - Imports a binary MAT-File(v4) to a GRASS raster. .SH KEYWORDS raster, import .SH SYNOPSIS \fBr.in.mat\fR .br \fBr.in.mat help\fR .br \fBr.in.mat\fR [\-\fBv\fR] \fBinput\fR=\fIstring\fR [\fBoutput\fR=\fIstring\fR] [\-\-\fBoverwrite\fR] [\-\-\fBverbose\fR] [\-\-\fBquiet\fR] .SS Flags: .IP "\fB\-v\fR" 4m .br Verbose mode .IP "\fB\-\-overwrite\fR" 4m .br Allow output files to overwrite existing files .IP "\fB\-\-verbose\fR" 4m .br Verbose module output .IP "\fB\-\-quiet\fR" 4m .br Quiet module output .PP .SS Parameters: .IP "\fBinput\fR=\fIstring\fR" 4m .br Name of an existing MAT-File(v4) .IP "\fBoutput\fR=\fIstring\fR" 4m .br Name for the output raster map (override) .PP .SH DESCRIPTION \fIr.in.mat\fR will import a GRASS raster map from a Version 4 MAT-File which was created with Matlab or Octave. Attributes such as map title and bounds will also be imported if they exist. .br .br Specifically, the following array variables will be read: .br .RE \fB map_data\fR \fB map_name\fR \fB map_title\fR \fB map_northern_edge\fR \fB map_southern_edge\fR \fB map_eastern_edge\fR \fB map_western_edge\fR .RE Any other variables in the MAT-file will be simply skipped over. .br .br The '\fBmap_name\fR' variable is optional, if it exists, and is valid, the new map will be thus named. If it doesn't exist or a name is specified with the \fBoutput=\fR option, the raster map's name will be set to \(dqMatFile" or the name specified respectively. (maximum 64 characters; normal GRASS naming rules apply) .br .br The '\fBmap_title\fR' variable is optional, the map's title is set if it exists. .br .br The '\fBmap_northern_edge\fR' and like variables are mandatory unless the user is importing to a "XY" non-georeferenced location (e.g. imagery data). Latitude and longitude values should be in decimal form. .SH NOTES \fIr.in.mat\fR imports a Version 4 MAT-File. These files can be successfully created with more modern versions of Matlab and Octave (see "EXAMPLES" below). .br Everything should be Endian safe, so the file to be imported can be simply copied between different system architectures without binary translation (caveat: see "TODO" below). .br As there is no IEEE value for NaN in integer arrays, GRASS's null value may be used to represent it within these maps. Usually Matlab will save any integer based matrix with NaN values as a double-precision floating point array, so this usually isn't an issue. To save space, once the map is loaded into GRASS you can convert it back to an integer map with the following command: \fC .DS .br r.mapcalc int_map="int(MATFile_map)" .br .DE \fR NaN values in either floating point or double-precision floating point matrices should translate into null values as expected. .br \fIr.in.mat\fR must load the entire map array into memory before writing, therefore it might have problems with \fIhuge\fR arrays. (a 3000x4000 DCELL map uses about 100mb RAM) .br GRASS defines its map bounds at the outer-edge of the bounding cells, not at the coordinates of their centroids. Thus, the following Matlab commands may be used to determine and check the map's resolution information will be correct: \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 Remember Matlab arrays are referenced as (row,column), i.e. (y,x). .br In addition, \fIr.in.mat\fR and \fIr.out.mat\fR make for a nice binary container format for transferring georeferenced maps around, even if you don't use Matlab or Octave. .SH EXAMPLES In Matlab, save with: \fC .DS .br save filename.mat map_* \-v4 .br .DE \fR In Octave, save with: \fC .DS .br save \-mat4-binary filename.mat map_* .br .DE \fR .br .SH TODO Robust support for mixed-Endian importation. \fI(This is a work in progress, please help by reporting any failures to the GRASS bug tracking system\fR; you will need to login with an OSGeo Userid) .br Add support for importing map history, category information, color map, etc. if they exist. .br Option to import a version 5 MAT-File, with map and support information stored in a single structured array. .SH BUGS If you encounter any problems, please contact the GRASS Development Team. .SH SEE ALSO \fI r.out.mat, r.in.ascii, r.in.bin, r.mapcalc, r.null. .PP 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