How to read some data in field at thingspeak and calculate | MATLAB IoT Analytics | Forum

Avatar

Please consider registering
Guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —






— Match —





— Forum Options —





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

sp_Feed sp_TopicIcon
How to read some data in field at thingspeak and calculate
No permission to create posts
April 4, 2019
3:04 am
Avatar
munip
New Member
Members
Forum Posts: 3
Member Since:
April 4, 2019
sp_UserOfflineSmall Offline

I got a problem to read some data in field in thingspeak, like field1. I want to rread and get all of the data and calculate the data like sum(field1). i dont know how to proces the syntax in matlab analysis in thingspeak. maybe can help me to find the solution?

April 4, 2019
10:01 am
Avatar
cstapels
Moderator
Members


Moderators
Forum Posts: 643
Member Since:
March 7, 2017
sp_UserOfflineSmall Offline

Have a look at this code:
https://www.mathworks.com/help/thingspeak/calculate-average-humidity.html
This code is for average, but you can replace that with a sum. It will show you how to read and process the data. Also there is a template for it when you create a new MATLAB analysis.

April 4, 2019
10:01 pm
Avatar
munip
New Member
Members
Forum Posts: 3
Member Since:
April 4, 2019
sp_UserOfflineSmall Offline

Thanks you so much, i got the solution @cstapels

how can we get entryid in like a field1, i have collect for 15 times, how can i show the entry_id like [1,2,3,.. ,15] and i want to operation the entry_id like sum,average and etc.

April 4, 2019
10:16 pm
Avatar
munip
New Member
Members
Forum Posts: 3
Member Since:
April 4, 2019
sp_UserOfflineSmall Offline

in matlab, when we export thingspeak data with csv format we got a coloum create_at, entry_id,field2
how we got an entry_id syntax in matlab in thingspeak, and calculate the entryid like sum, average and etc.

April 8, 2019
8:42 am
Avatar
cstapels
Moderator
Members


Moderators
Forum Posts: 643
Member Since:
March 7, 2017
sp_UserOfflineSmall Offline

Are you looking to add a column of index labels to your exported data? If you use a timetable, you can probably easily append this index.
Here is an example using the cheerlights channel:

myTable=thingSpeakRead(1417,'numPoints',15,'outputFormat','timetable');
index=(1:15);
myTable=addvars(myTable,index','before',1);

You can index into MATLAB matricies, arrays, and even timetables though, you don't actually need row numbers, unless you are just looking to add that for display reasons.

Forum Timezone: America/New_York

Most Users Ever Online: 166

Currently Online:
30 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

rw950431: 272

Vinod: 240

piajola: 95

turgo: 70

vespapierre: 63

Adarsh_Murthy: 62

Member Stats:

Guest Posters: 1

Members: 8665

Moderators: 1

Admins: 2

Forum Stats:

Groups: 3

Forums: 14

Topics: 1600

Posts: 5760

Newest Members:

porosh2019, KellyBrise, sunainakhanna, flail, sathwik, samlewis02

Moderators: cstapels: 460

Administrators: Hans: 405, lee: 457