3
<em>r.in.mat</em> will import a GRASS raster map from a Version 4 MAT-File
4
which was created with Matlab or Octave.
5
Attributes such as map title and bounds will also be imported if they exist.
8
Specifically, the following array variables will be read:<br>
13
<li><b> map_northern_edge</b>
14
<li><b> map_southern_edge</b>
15
<li><b> map_eastern_edge</b>
16
<li><b> map_western_edge</b>
19
Any other variables in the MAT-file will be simply skipped over.<br>
21
The '<b>map_name</b>' variable is optional, if it exists, and is valid, the
22
new map will be thus named. If it doesn't exist or a name is specified with
23
the <b>output=</b> option, the raster map's name will be set to
24
"<tt>MatFile</tt>" or the name specified respectively.
25
(maximum 64 characters; normal GRASS naming rules apply)
28
The '<b>map_title</b>' variable is optional, the map's title is set if it
32
The '<b>map_northern_edge</b>' and like variables are mandatory unless the
33
user is importing to a "XY" non-georeferenced location
34
(e.g. imagery data). Latitude and longitude values should be in decimal form.
39
<em>r.in.mat</em> imports a Version 4 MAT-File. These files can be
40
successfully created with more modern versions of Matlab and Octave
41
(see "EXAMPLES" below).<br><br>
43
Everything should be Endian safe, so the file to be imported can be simply
44
copied between different system architectures without binary translation
45
(caveat: see "TODO" below).<br><br>
47
As there is no IEEE value for <tt>NaN</tt> in integer arrays, GRASS's null
48
value may be used to represent it within these maps. Usually Matlab will save
49
any integer based matrix with <tt>NaN</tt> values as a double-precision
50
floating point array, so this usually isn't an issue. To save space, once the
51
map is loaded into GRASS you can convert it back to an integer map with the
53
<div class="code"><pre>
54
r.mapcalc int_map="int(MATFile_map)"
57
<tt>NaN</tt> values in either floating point or double-precision floating point
58
matrices should translate into null values as expected.<br><br>
61
<em>r.in.mat</em> must load the entire map array into memory before writing,
62
therefore it might have problems with <i>huge</i> arrays.
63
(a 3000x4000 DCELL map uses about 100mb RAM)<br><br>
65
GRASS defines its map bounds at the outer-edge of the bounding cells, not at
66
the coordinates of their centroids. Thus, the following Matlab commands may
67
be used to determine and check the map's resolution information will be correct:
68
<div class="code"><pre>
69
[rows cols] = size(map_data)
70
x_range = map_eastern_edge - map_western_edge
71
y_range = map_northern_edge - map_southern_edge
77
Remember Matlab arrays are referenced as <tt>(row,column)</tt>,
80
In addition, <em>r.in.mat</em> and <em>r.out.mat</em> make for a nice
81
binary container format for transferring georeferenced maps around,
82
even if you don't use Matlab or Octave.
87
<div class="code"><pre>
88
save filename.mat map_* -v4
92
<div class="code"><pre>
93
save -mat4-binary filename.mat map_*
100
Robust support for mixed-Endian importation.
101
<i>(This is a work in progress, please help by reporting any failures to the
102
<a href="http://trac.osgeo.org/grass/">
103
GRASS bug tracking system</a></i>; you will need to login with an OSGeo Userid)
105
Add support for importing map history, category information, color map, etc.
108
Option to import a version 5 MAT-File, with map and support information
109
stored in a single structured array.
113
If you encounter any problems, please contact the GRASS Development Team.
118
<a href="r.out.mat.html">r.out.mat</a>,
119
<a href="r.in.ascii.html">r.in.ascii</a>,
120
<a href="r.in.bin.html">r.in.bin</a>,
121
<a href="r.mapcalc.html">r.mapcalc</a>,
122
<a href="r.null.html">r.null</a>.<p>
123
The <a href="http://www.octave.org">Octave</a> project
129
Hamish Bowman<br> <i>
130
Department of Marine Science<br>
131
University of Otago<br>
135
<p><i>Last changed: $Date: 2008-05-21 15:04:10 +0200 (Wed, 21 May 2008) $</i>