@@ -57,49 +57,33 @@ influxdb.setWriteTimeout(10);
57
57
Writing data
58
58
------------
59
59
60
- Use the ` Point ` builder to create samples , then save them in a batch :
60
+ Use the ` Series ` builder to prepare the data , then write it using the client :
61
61
62
62
``` matlab
63
- % Create a point
64
- p1 = Point ('weather') ...
63
+ % Create a series with a single sample
64
+ series1 = Series ('weather') ...
65
65
.tags('city', 'barcelona', 'country', 'catalonia') ...
66
66
.fields('temperature', 24.3, 'humidity', 70.4) ...
67
- .time(datetime('now ', 'TimeZone', 'local'));
67
+ .time(datetime('today ', 'TimeZone', 'local'));
68
68
69
- % Create another point
70
- p2 = Point ('weather') ...
69
+ % Create a series with many samples
70
+ series2 = Series ('weather') ...
71
71
.tags('city', 'copenhagen', 'country', 'denmark') ...
72
- .fields('temperature', 12.6, 'humidity', 45.7) ...
73
- .time(datetime('now', 'TimeZone', 'local'));
74
-
75
- % Create an array of points
76
- array = [p3, p4, etc];
77
-
78
- % Save all the points
79
- influxdb.writer() ...
80
- .append(p1, p2, etc) ...
81
- .append(array) ...
82
- .execute();
83
- ```
84
-
85
- It is possible to save * large* amounts of samples using the ` Series ` builder:
86
-
87
- ``` matlab
88
- % Create a series with many points
89
- series1 = Series('weather') ...
90
- .tags('city', 'stockholm', 'country', 'sweden') ...
91
- .fields('temperature', [10.5; 11.2; 9.7]) ...
92
- .time(datetime('now', 'TimeZone', 'local') - [0; 1; 2] / 24);
72
+ .fields('temperature', [12.6; 11.8], 'humidity', [45.7; 46.3]) ...
73
+ .time(datetime('now', 'TimeZone', 'local') - [0; 1] / 24);
93
74
94
75
% Create a series from an existing timetable
95
- ttable = timetable(time, variables, etc);
96
- series2 = Series('weather') ...
76
+ series3 = Series('weather') ...
97
77
.tags('city', 'helsinki', 'country', 'finland') ...
98
- .import(ttable);
78
+ .import(my_timetable);
79
+
80
+ % Create an array of series
81
+ series_array = [series4, series5, etc];
99
82
100
- % Save the series
83
+ % Save all the series in a batch
101
84
influxdb.writer() ...
102
- .append(series1, series2) ...
85
+ .append(series1, series2, series3) ...
86
+ .append(series_array) ...
103
87
.execute();
104
88
```
105
89
@@ -112,7 +96,7 @@ influxdb.writer() ...
112
96
.precision('ms') ...
113
97
.retention('two_weeks') ...
114
98
.consistency('quorum') ...
115
- .append(points, series ) ...
99
+ .append(series, etc ) ...
116
100
.execute();
117
101
```
118
102
0 commit comments