Skip to content

Commit d62410f

Browse files
author
Enric Sala
committed
Add a method to series result for converting to a table
1 parent 04863b1 commit d62410f

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,9 @@ time = weather.time('Europe/Amsterdam');
170170
temperature = weather.field('temperature');
171171
plot(time, temperature);
172172
173-
% Convert a series to a timetable
174-
ttable = weather.timetable('Europe/Paris');
173+
% Convert a series to a table or timetable
174+
mytable = weather.table();
175+
mytable = weather.timetable('Europe/Paris');
175176
```
176177

177178
Notice that the `time()` and `timetable()` methods take an optional timezone argument.

influxdb-client/SeriesResult.m

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@
5050
values = obj.Values(idx).value;
5151
end
5252

53+
% Convert to a table
54+
function result = table(obj)
55+
vars = {obj.Values.value};
56+
result = table(vars{:}, 'VariableNames', obj.fields());
57+
end
58+
5359
% Convert to a timetable, with an optional timezone
5460
function ttable = timetable(obj, timezone)
5561
if nargin > 1

0 commit comments

Comments
 (0)