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

5 ビュー (過去 30 日間)
Shore
Shore 2023 年 12 月 7 日
コメント済み: Shore 2023 年 12 月 16 日
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
Sulaymon Eshkabilov 2023 年 12 月 7 日
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 コミュニティ

カテゴリ

Help Center および File ExchangeVisualize Data についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by