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