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