In thingspeak , how can I visualize two or more channels on one page so I can view different fields from different nodes at a time ?

35 次查看(过去 30 天)
I'm working on a project that contains several distributed nodes. I assigned one channel for each node. my question is " how can I visualize the data coming from different channels on one page?
  3 个评论
Alaa
Alaa 2022-7-27
编辑:Alaa 2022-7-27
Thank you Mr.Stapels
You are right . this is first time to work on MATLAB.
Kindly, can you guide me to the "provided template code" you mentioned and any available previous similar projects?
also, I'm planning to buy a student license. can I get "automatically refresh" with this type of license?
Regards,

请先登录,再进行评论。

回答(3 个)

Christopher Stapels
In the tabs on the top of the ThingSpeak site, Click on Apps > MATLAB Visualizations then click the green 'New' button, and you will see choices for template code. You can do the same thing to get MATLAB analysis template code as well. The apps are similar, but you need the visualizations app to do visualizations and you can only use code writte in the analysis app for a trigger in React or TimeControl.
For other great examples, see the doc, and click the examples tab. There is an example relating to each of the template codes, for example this one on multi-day visualizations.
  3 个评论
Christopher Stapels
To read multiple channels, change the channel id in the thingSpeakRead function. The multi day visualizations does in fact help answer this question in that it shows you how to make consecutive calls to thingSpeakRead, and shows a way to assemble the data. If you take that example and use consecutive reads with different channel id's (and perhaps different field id's), you will have what you indicated in your question. If you are still stuck, please consider starting a new question and describing your issue in detail.
ynit
ynit 2023-5-29
hi, i'm quite new to thingspeak. i would just like to ask how often does it read data from other channels and write data to another channel?

请先登录,再进行评论。


loli
loli 2023-5-14
编辑:loli 2023-5-14
% Replace the placeholders with your ThingSpeak channel IDs
channelID1 = 12345; % Channel 1 ID
channelID3 = 67890; % Channel 3 ID
channelID4 = 98765; % Channel 4 ID
% Replace the placeholders with your ThingSpeak read API keys
readAPIKey1 = 'YOUR_READ_API_KEY1';
readAPIKey3 = 'YOUR_READ_API_KEY3';
readAPIKey4 = 'YOUR_READ_API_KEY4';
% Read the data from channel 3
[data3, time3] = thingSpeakRead(channelID3, 'ReadKey', readAPIKey3);
% Read the data from channel 4
[data4, time4] = thingSpeakRead(channelID4, 'ReadKey', readAPIKey4);
% Combine the data from channel 3 and channel 4
combinedData = [data3, data4];
combinedTime = [time3, time4];
% Write the combined data to channel 1
thingSpeakWrite(channelID1, combinedData, 'WriteKey', readAPIKey1, 'TimeStamp', combinedTime);
here i write a code To show channel 4 and channel 3 data in channel 1 on ThingSpeak, you can use MATLAB code or the ThingSpeak API. Here's an example of how you can achieve this using MATLAB code:
i hope you can get it ..

loli
loli 2023-5-14
% Replace the placeholders with your ThingSpeak channel IDs
channelID1 = 12345; % Channel 1 ID
channelID3 = 67890; % Channel 3 ID
channelID4 = 98765; % Channel 4 ID
% Replace the placeholders with your ThingSpeak read API keys
readAPIKey1 = 'YOUR_READ_API_KEY1';
readAPIKey3 = 'YOUR_READ_API_KEY3';
readAPIKey4 = 'YOUR_READ_API_KEY4';
% Read the data from channel 3
[data3, time3] = thingSpeakRead(channelID3, 'ReadKey', readAPIKey3);
% Read the data from channel 4
[data4, time4] = thingSpeakRead(channelID4, 'ReadKey', readAPIKey4);
Channel ID must be a positive integer.
% Combine the data from channel 3 and channel 4
combinedData = [data3, data4];
combinedTime = [time3, time4];
% Write the combined data to channel 1
thingSpeakWrite(channelID1, combinedData, 'WriteKey', readAPIKey1, 'TimeStamp', combinedTime);

社区

更多回答在  ThingSpeak Community

类别

Help CenterFile Exchange 中查找有关 Write Data to Channel 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by