1r.out.mat(1) Grass User's Manual r.out.mat(1)
2
3
4
6 r.out.mat - Exports a GRASS raster to a binary MAT-File.
7
9 raster, export
10
12 r.out.mat
13 r.out.mat help
14 r.out.mat [-v] input=name output=string [--verbose] [--quiet]
15
16 Flags:
17 -v
18 Verbose mode
19
20 --verbose
21 Verbose module output
22
23 --quiet
24 Quiet module output
25
26 Parameters:
27 input=name
28 Name of input raster map
29
30 output=string
31 Name for the output binary MAT-File
32
34 r.out.mat will export a GRASS raster map to a MAT-File which can be
35 loaded into Matlab or Octave for plotting or further analysis.
36 Attributes such as map title and bounds will also be exported into
37 additional array variables.
38 Specifically, the following array variables are created:
39
40 map_data
41
42 map_name
43
44 map_title (if it exists)
45
46 map_northern_edge
47
48 map_southern_edge
49
50 map_eastern_edge
51
52 map_western_edge
53 In addition, r.out.mat makes for a nice binary container format for
54 transferring georeferenced maps around, even if you don't use Matlab or
55 Octave.
56
58 r.out.mat exports a Version 4 MAT-File. These files should successfully
59 load into more modern versions of Matlab and Octave without any prob‐
60 lems.
61 Everything should be Endian safe, so the resultant file can be simply
62 copied between different system architectures without binary transla‐
63 tion.
64 As there is no IEEE value for NaN for integer maps, GRASS's null value
65 is used to represent it within these maps. You'll have to do something
66 like this to clean them once the map is loaded into Matlab:
67 Null values in maps containing either floating point or double-preci‐
68 sion
69 floating point data should translate into <tt>NaN values as expected.
70 r.out.mat must load the entire map into memory before writing,
71 therefore it might have problems with huge maps.
72 (a 3000x4000 DCELL map uses about 100mb RAM)
73 GRASS defines its map bounds at the outer-edge of the bounding cells,
74 not at
75 the coordinates of their centroids. Thus, the following Matlab commands
76 may
77 be used to determine the map's resolution information:
78
79 [rows cols] = size(map_data)
80 x_range = map_eastern_edge - map_western_edge
81 y_range = map_northern_edge - map_southern_edge
82 ns_res = y_range/rows
83 ew_res = x_range/cols
84
85
87 In Matlab, plot with either:
88 imagesc(map_data), axis equal, axis tight, colorbar
89 or
90 contourf(map_data, 24), axis ij, axis equal, axis tight, colorbar
91
92
94 Add support for exporting map history, category information, color map,
95 etc.
96 Option to export as a version 5 MAT-File, with map and support informa‐
97 tion stored in a single structured array.
98
100 r.in.mat
101 r.out.bin
102 r.null
103 The Octave project
104
106 Hamish Bowman
107
108 Department of Marine Science
109 University of Otago
110 New Zealand
111
112 Last changed: $Date: 2005-12-12 15:53:40 +0100 (Mon, 12 Dec 2005) $
113
114 Full index
115
116 © 2003-2008 GRASS Development Team
117
118
119
120GRASS 6.3.0 r.out.mat(1)