Plot a temperature scraped (time control set to 5 minutes) off a weather service?

4 次查看(过去 30 天)
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.

采纳的回答

Shore
Shore 2023-12-8
编辑:Shore 2023-12-10
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.
  1 个评论
Shore
Shore 2023-12-16
Comment: I realize that one way to incorporate local airport temperature into a multi field channel is to scrape the local weather channel in the microprocessor wifi code instead of Matlab analysis and related time control, then write API all ThinkSpeak fields at once including airport temperature.

请先登录,再进行评论。

更多回答(1 个)

Sulaymon Eshkabilov
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 个评论
Shore
Shore 2023-12-7
编辑:Shore 2023-12-10
Sulaymon,
Thank you for your keen insight. Your answer works for offline plotting.
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
thanks
Shore
Shore 2023-12-8
编辑:Shore 2023-12-10
comment:
My investigation led me to take one of my unused channels and ONLY use the 5 minute time control on my matlab analysis on only 1 field, to aquire airport temperature in another city and try to plot it.
As can be seen above, the scraped data CAN be plotted because there are no gaps in the readings.

请先登录,再进行评论。

社区

更多回答在  ThingSpeak Community

类别

Help CenterFile Exchange 中查找有关 Visualize Data 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by