3:04 pm

September 19, 2016

Hello, I am getting error "Index exceeds matrix dimensions" after running this peace of code in matlab analysis.
readChannelID = 106292;
pumpFieldId = 5;
readAPIKey = 'myApiKey';
timeRange = 10;
[pump, timeStamp] = thingSpeakRead(readChannelID, 'Fields', pumpFieldId, 'numMinutes', timeRange, 'ReadKey', readAPIKey);
I can successfully read other channel's fields, except field5. This was working until September 15th. I have tried clear channel, but still it doesn't work. I have no idea what could be wrong.
4:21 pm


MathWorks
August 25, 2015

Hi Paul,
I couldn't reproduce the error on my end since channel 106292 is a private channel. I replaced the channel ID with 12397, and the following code worked:
readChannelID = 12397;
pumpFieldId = 5;
timeRange = 10;
[pump, timeStamp] = thingSpeakRead(readChannelID, 'Fields', pumpFieldId, 'numMinutes', timeRange);
Could you share the last 10 minutes worth of data in your channel (in json format) using the GET Feed endpoint (https://www.mathworks.com/help/thingspeak/get-a-channel-feed.html)?
4:44 pm

September 19, 2016

Here you goI am afraid that it is channel specific problem.{"channel":{"id":106292,"name":"Solar heating","latitude":"0.0","longitude":"0.0","field1":"collector","field2":"boiler_mid","field3":"boiler_bottom","field5":"pump_state","created_at":"2016-04-06T14:50:48+03:00","updated_at":"2016-09-19T23:35:10+03:00","last_entry_id":52},"feeds":[{"created_at":"2016-09-19T22:57:09+03:00","entry_id":33,"field1":"9.31","field2":"52.44","field3":"21.88","field5":"0"},{"created_at":"2016-09-19T22:59:07+03:00","entry_id":34,"field1":"9.31","field2":"52.31","field3":"21.88","field5":"0"},{"created_at":"2016-09-19T23:01:11+03:00","entry_id":35,"field1":"9.25","field2":"52.31","field3":"21.88","field5":"0"},{"created_at":"2016-09-19T23:03:10+03:00","entry_id":36,"field1":"9.25","field2":"52.25","field3":"21.88","field5":"0"},{"created_at":"2016-09-19T23:05:08+03:00","entry_id":37,"field1":"9.25","field2":"52.13","field3":"21.88","field5":"0"},{"created_at":"2016-09-19T23:07:06+03:00","entry_id":38,"field1":"9.19","field2":"52.13","field3":"21.88","field5":"0"},{"created_at":"2016-09-19T23:09:10+03:00","entry_id":39,"field1":"9.13","field2":"52.13","field3":"21.81","field5":"0"},{"created_at":"2016-09-19T23:11:08+03:00","entry_id":40,"field1":"9.13","field2":"52.00","field3":"21.75","field5":"0"},{"created_at":"2016-09-19T23:13:06+03:00","entry_id":41,"field1":"9.13","field2":"52.44","field3":"21.63","field5":"0"},{"created_at":"2016-09-19T23:15:11+03:00","entry_id":42,"field1":"9.06","field2":"52.88","field3":"21.63","field5":"0"},{"created_at":"2016-09-19T23:17:09+03:00","entry_id":43,"field1":"9.06","field2":"53.00","field3":"21.63","field5":"0"},{"created_at":"2016-09-19T23:19:07+03:00","entry_id":44,"field1":"9.00","field2":"53.00","field3":"21.63","field5":"0"},{"created_at":"2016-09-19T23:21:11+03:00","entry_id":45,"field1":"9.00","field2":"52.88","field3":"21.63","field5":"0"},{"created_at":"2016-09-19T23:23:09+03:00","entry_id":46,"field1":"9.00","field2":"52.75","field3":"21.63","field5":"0"},{"created_at":"2016-09-19T23:25:07+03:00","entry_id":47,"field1":"8.94","field2":"52.69","field3":"21.63","field5":"0"},{"created_at":"2016-09-19T23:27:12+03:00","entry_id":48,"field1":"9.00","field2":"52.56","field3":"21.69","field5":"0"},{"created_at":"2016-09-19T23:29:09+03:00","entry_id":49,"field1":"8.94","field2":"52.50","field3":"21.69","field5":"0"},{"created_at":"2016-09-19T23:31:08+03:00","entry_id":50,"field1":"8.88","field2":"52.44","field3":"21.69","field5":"0"},{"created_at":"2016-09-19T23:33:05+03:00","entry_id":51,"field1":"8.94","field2":"52.38","field3":"21.69","field5":"0"},{"created_at":"2016-09-19T23:35:10+03:00","entry_id":52,"field1":"8.94","field2":"52.25","field3":"21.69","field5":"0"}]}
8:40 am


MathWorks
August 25, 2015

Thanks for sharing the data. I am able to reproduce the error.
While we are working on fixing thingSpeakRead, here are two options that you could consider:
Option 1:
- Enable Field 4: In the channel settings tab of Channel 106292, enable Field 4 by selecting the check box. This should resolve the error. Note that you don't need to add Field 4 Chart to your Channel view page. To disable the Field 4 chart, click on the 'x'. You can add it back later by using the 'Add Visualizations' button.
Option 2:
- Edit the thingSpeakRead call: Instead of option 1, you could change the MATLAB code to:
[data, timeStamp] = thingSpeakRead(readChannelID, 'numMinutes', timeRange, 'ReadKey', readAPIKey);
pump = data(:, 4);
Let me know if this doesn't fix the error for you. We will post again when thingSpeakRead() is updated.
Thanks,
Adarsh
Most Users Ever Online: 166
Currently Online:
33 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:
kusmumichael, petersmith99, Rambant, blakeharriss09, optisol, Niyonzima FilsModerators: cstapels: 460
Administrators: Hans: 405, lee: 457