Combine 3 private channels in to one graph | MATLAB | 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
Combine 3 private channels in to one graph
No permission to create posts
June 21, 2016
8:37 am
Avatar
jamin
New Member
Members
Forum Posts: 2
Member Since:
June 21, 2016
sp_UserOfflineSmall Offline

Hey,

Im trying to get around the 15 sec update limit by having 3 channels that update depending on a few counters on the arduino.

I was hoping the next part would be easy, but it isn't.

The data I am sending to each channel is very basic. Its a door bell counter, so its either 0 or 1.

If the bell is pressed a few times within 15 seconds, then it will send the three 1's to different channels. The rest of the presses are disregarded.

I would like to show the combined presses with a 30sec timescale on another channel as a vertical line graph.

Can anyone help?

 

This is what I have so far:

 

readChannelID1 = XXXXXX;
readChannelID2 = XXXXXX;
readChannelID3 = XXXXXX;

readAPIKey1 = 'XXXXXXXXXXXXXXXXX';
readAPIKey2 = 'XXXXXXXXXXXXXXXXX';
readAPIKey3 = 'XXXXXXXXXXXXXXXXX';

chan1 = thingSpeakRead(readChannelID1, 'Fields', 1, 'ReadKey', readAPIKey1, 'NumDays',2);
chan2 = thingSpeakRead(readChannelID2, 'Fields', 1, 'ReadKey', readAPIKey2, 'NumDays',2);
chan3 = thingSpeakRead(readChannelID3, 'Fields', 1, 'ReadKey', readAPIKey3, 'NumDays',2);

thingSpeakPlot(chan1, chan2, chan3);
June 21, 2016
8:39 pm
Avatar
rw950431

Top
Members
Forum Posts: 262
Member Since:
January 30, 2014
sp_UserOfflineSmall Offline

Suspect you need to read the timestamps as well as the data from the 3 channels .   I dont know enough Matlab to show exactly how to do this Frown  maybe this will work, maybe not

 

[data1,time1] = thingSpeakRead(..)
[data2,time2] = thingSpeakRead(..)
[data3,time3] = thingSpeakRead(..)

plot(time1,data1,time2,data2,time3,data3)

 

(Based off https://au.mathworks.com/help/matlab/ref/plot.html)

June 22, 2016
3:12 am
Avatar
jamin
New Member
Members
Forum Posts: 2
Member Since:
June 21, 2016
sp_UserOfflineSmall Offline

Hey rw950431,

This is creating the error

Error using horzcat
Dimensions of matrices being concatenated are not consistent.

Will keep searching Google.

Cheers

June 22, 2016
9:52 pm
Avatar
rw950431

Top
Members
Forum Posts: 262
Member Since:
January 30, 2014
sp_UserOfflineSmall Offline

Guessing that its complaining because the arrays have different numbers of data points..  Does it work if you only plot one series at a time?

plot(time1,data1)

You may end having to figure out how to merge the 3 datasets together before plotting- please show me how to do it when you figure it out..

Forum Timezone: America/New_York

Most Users Ever Online: 114

Currently Online:
18 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

rw950431: 261

Vinod: 196

piajola: 85

turgo: 70

vespapierre: 63

Adarsh_Murthy: 62

Member Stats:

Guest Posters: 1

Members: 5703

Moderators: 0

Admins: 2

Forum Stats:

Groups: 4

Forums: 17

Topics: 1313

Posts: 4565

Newest Members:

BarryMaync, ThomasRougs, DonaldGen, prince, JrGordon, Elamsweems

Administrators: Hans: 387, lee: 457