1r.in.mat(1)                   Grass User's Manual                  r.in.mat(1)
2
3
4

NAME

6       r.in.mat  - Import a binary MAT-File(v4) to a GRASS raster.
7

KEYWORDS

9       raster
10

SYNOPSIS

12       r.in.mat
13       r.in.mat help
14       r.in.mat [-v] input=string  [output=string]   [--overwrite]
15
16   Flags:
17       -v  Verbose mode
18
19       --overwrite
20
21   Parameters:
22       input=string
23           Name of an existing MAT-File(v4)
24
25       output=string
26           Name for the output raster map (override)
27

DESCRIPTION

29       r.in.mat will import a GRASS raster map from a Version 4 MAT-File which
30       was created with Matlab or Octave.  Attributes such as  map  title  and
31       bounds will also be imported if they exist.
32       Specifically, the following array variables will be read:
33
34                      map_data
35
36                      map_name
37
38                      map_title
39
40                      map_northern_edge
41
42                      map_southern_edge
43
44                      map_eastern_edge
45
46                      map_western_edge
47       Any other variables in the MAT-file will be simply skipped over.
48       The  'map_name'  variable  is optional, if it exists, and is valid, the
49       new map will be thus named. If it doesn't exist or a name is  specified
50       with the output= option, the raster map's name will be set to "MatFile"
51       or the name specified respectively.   (maximum  64  characters;  normal
52       GRASS naming rules apply)
53       The  'map_title'  variable  is  optional,  the map's title is set if it
54       exists.
55       The 'map_northern_edge' and like variables  are  mandatory  unless  the
56       user  is  importing  to a "XY" non-georeferenced location (e.g. imagery
57       data). Latitude and longitude values should be in decimal form.
58

NOTES

60       r.in.mat imports a Version 4 MAT-File. These files can be  successfully
61       created  with more modern versions of Matlab and Octave (see "EXAMPLES"
62       below).
63       Everything should be Endian safe, so the file to  be  imported  can  be
64       simply  copied  between  different  system architectures without binary
65       translation (caveat: see "TODO" below).
66       As there is no IEEE value for NaN in integer arrays, GRASS's null value
67       may be used to represent it within these maps. Usually Matlab will save
68       any integer based matrix with NaN values as a double-precision floating
69       point  array,  so  this usually isn't an issue. To save space, once the
70       map is loaded into GRASS you can convert it back to an integer map with
71       the following command:
72       r.mapcalc int_map="int(MATFile_map)"
73        NaN values in either floating point or double-precision floating point
74       matrices should translate into null values as expected.
75       r.in.mat must load the entire map array  into  memory  before  writing,
76       therefore  it might have problems with huge arrays.  (a 3000x4000 DCELL
77       map uses about 100mb RAM)
78       GRASS defines its map bounds at the outer-edge of the  bounding  cells,
79       not  at  the coordinates of their centroids. Thus, the following Matlab
80       commands may be used to determine and check the map's resolution infor‐
81       mation will be correct:
82           [rows cols] = size(map_data)
83           x_range = map_eastern_edge - map_western_edge
84           y_range = map_northern_edge - map_southern_edge
85           ns_res = y_range/rows
86           ew_res = x_range/cols
87
88       Remember Matlab arrays are referenced as (row,column), i.e. (y,x).
89       In  addition,  r.in.mat  and r.out.mat make for a nice binary container
90       format for transferring georeferenced maps around, even  if  you  don't
91       use Matlab or Octave.
92

EXAMPLES

94       In Matlab, save with:
95       save filename.mat map_* -v4
96        In Octave, save with:
97       save -mat4-binary filename.mat map_*
98
99

TODO

101       Robust  support  for  mixed-Endian  importation.   (This  is  a work in
102       progress, please help by reporting any failures to the GRASS bug track‐
103       ing system)
104       Add support for importing map history, category information, color map,
105       etc.  if they exist.
106       Option to import a version 5 MAT-File, with map and support information
107       stored in a single structured array.
108

BUGS

110       If  you  encounter  any  problems, please contact the GRASS Development
111       Team.
112

SEE ALSO

114        r.out.mat, r.in.ascii, r.in.bin, r.mapcalc, r.null.
115
116       The Octave project
117

AUTHOR

119       Hamish Bowman
120
121       Department of Marine Science
122       University of Otago
123       New Zealand
124
125       Last changed: $Date: 2006/04/21 09:06:24 $
126
127       Full index
128
129
130
131GRASS 6.2.2                                                        r.in.mat(1)
Impressum