Average 3 fields and dynamic update | MATLAB | Forum

Avatar

Please consider registering
Guest

Search

— Forum Scope —






— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

Register Lost password?
sp_Feed sp_TopicIcon
Average 3 fields and dynamic update
Avatar
David
New Member
Forum Posts: 4
sp_UserOfflineSmall Offline
1
September 15, 2016 - 12:28 pm
sp_Permalink sp_Print

This is really a 2 part question:

1. How do you average data from 3 fields that I've read in using thingSpeakRead?  This is data taken from 3 different temperature sensors that I want to average across the 3 sensors and have this be done for each time that the samples are taken.  In other words, I want to calculate and display one temp-time graph out of 3.

2. How do you automatically trigger a refresh based on data that is being updated/sent to ThingSpeak?

Avatar
Robert Mawrey
New Member
Forum Posts: 4
sp_UserOfflineSmall Offline
2
September 15, 2016 - 9:53 pm
sp_Permalink sp_Print

Here is the basic outline.  Create a MATLAB analysis that does something like this:

______________

Temp1 = thingSpeakRead ...
Temp2 = thingSpeakRead ...
Temp3 = thingSpeakRead ...

allTemp = [Temp1,Temp2,Temp3];

meanTemp = mean(allTemp);

chID = xxxxx; % Your channel ID for the mean temp

% Write the mean to a new channel

thingSpeakWrite(chId,meanTemp);

_______________

To "automatically trigger a refresh based on data that is being updated/sent to ThingSpeak" use the React App to run your MATLAB analysis on insert of your data (assuming you can reliably use one of you three temp readings to trigger with the other two already updated).  If React timing is an issue then try the TimeControl App.

Avatar
Rob Purser
Natick, MA

Forum Posts: 46
sp_UserOfflineSmall Offline
3
September 16, 2016 - 8:45 am
sp_Permalink sp_Print

You may also find the movmean and movmedian functions to be highly useful as well.

 

-Rob

Senior Development Manager for IoT and Hardware Interfacing for MATLAB at MathWorks.  Visit ThingSpeak.com to explore the IoT Analytic platform that speaks MATLAB made for engineers and scientists.  You can collect, analyze, and act in 5 minutes or less!

Avatar
David
New Member
Forum Posts: 4
sp_UserOfflineSmall Offline
4
September 19, 2016 - 6:33 pm
sp_Permalink sp_Print

Exactly what I was looking for.  Thanks for the help! 

Forum Timezone: America/New_York

Most Users Ever Online: 114

Currently Online:
26 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

rw950431: 252

Vinod: 164

cstapels: 96

piajola: 75

vespapierre: 63

Adarsh_Murthy: 59

Newest Members:

epicpaymentsny

DanielBobby

mercedeszw18

ujuxoketate

olihfez

winnieeq69

Forum Stats:

Groups: 4

Forums: 17

Topics: 1313

Posts: 4565

 

Member Stats:

Guest Posters: 1

Members: 5703

Moderators: 0

Admins: 2

Administrators: Hans, lee