I believe that at the free license level of subscription, plotting data needs to be all written to ThingSpeak at the same time, so that all "write" fields are populated.
Plot a temperature scraped (time control set to 5 minutes) off a weather service?
5 views (last 30 days)
Show older comments
I scrape the temperature of my town from a weather service. I set time control to do this every 5 minutes and then send it to my field 6 in my channel.
When I do a csv data dump, the data looks like this:
FIELDS--- 1 2 3 4 5 6 7 8
2023-12-06T22:12:06-05:00 600020 36
2023-12-06T22:12:29-05:00 600021 59 55 55 0 0 -0.61 0
2023-12-06T22:13:08-05:00 600022 59 55 56 0 0 -0.60 0 etc, etc...
So, every 5 minutes, field 6 gets a value. The other fields get a value twice a minute or so.
The ThingSpeak widgets (gage, chart, digital) work fine for field 6. ThingSpeak just uses the data it finds in field 6 for widgets.
But, my attempted at #6 field plot visualization is blank, because my plotting uses "points", for example, 300 points, and as such, out of 300 reads there are maybe 270 blank #6 fields and 30 filled-in #6 fields. I think that if I upgrade to a paid license, I would be able to fix this issue, but it is not important for my present needs, not having toolbox access with my license, but is is under consideration.
0 Comments
Accepted Answer
More Answers (1)
Sulaymon Eshkabilov
on 7 Dec 2023
This is a really interesting exercise. Here is one quick but not sufficiently accurate solution to get the numerical data imported correctly and plot them. Note that the downloaded .csv is also saved in an .xlsx format to read/import field1 to field8 columns. If your time steps are uniform then it might be a quick solution.
% Original data
D0 = readtimetable('feed_TS.csv');
% Time steps are obtained
Time = discretize(diff(D0.Var1), 'second');
Time = [0; Time]; % Initial value
Time = cumsum(Time); % Time history
% To get the data
D = readmatrix('feed_TS0.xlsx', 'Range', 'C2:J101');
plot(Time, D)
grid on
xlabel('Time, [s]')
ylabel('Temp')
2 Comments
Communities
More Answers in the ThingSpeak Community
See Also
Categories
Find more on Visualize Data in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!