I get a MATLABerror, please explain.

Fox on 3 May 2023
Latest activity Reply by Christopher Stapels on 4 May 2023

I try this code in MATLAB:
This code working fine:
readChannelID = [1788078];
fieldID1 = [1];
readAPIKey = '';
[data, time] = thingSpeakRead(readChannelID, 'Field', fieldID1, 'NumPoints', 30, 'ReadKey', readAPIKey);
plot(time, data);
This code have error : Unrecognized table variable name 'x1'.
readChannelID = [1788078];
fieldID1 = [2];
readAPIKey = '';
[data, time] = thingSpeakRead(readChannelID, 'Field', fieldID1, 'NumPoints', 30, 'ReadKey', readAPIKey);
plot(time, data);
What i do wrong? Thanks.
Christopher Stapels
Christopher Stapels on 4 May 2023
Please consider changing your field names to all latin based characters. We will look into this issue.
try this:
data=thingSpeakRead(readChannelID,'OutputFormat','timetable');
You will get a timetable with the timestamps and all the field values. You can access data from a field using the field name or the field number
data.fieldname
data.(1)
timestamps:
data.Timestamps
Fox
1
Post
0
Replies

Tags

No tags entered yet.