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?
조회 수: 2 (최근 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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1562559/image.png)
댓글 수: 0
채택된 답변
추가 답변 (1개)
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
커뮤니티
더 많은 답변 보기: ThingSpeak 커뮤니티
참고 항목
카테고리
Help Center 및 File Exchange에서 Visualize Data에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!