Clear Filters
Clear Filters

'Values' must have a maximum of 9 elements, including the timestamp. My data only send up to 9 data to thingspeak and this error occur.

1 view (last 30 days)
Hi. Im trying to send data from matlab which is the data from serial monitor from arduino. It is fine until 9th of data and then it stopped and says :
Error using Untitled (line 27)
'Values' must have a maximum of 9 elements, including the timestamp.
My coding is:
clear all
s = serial('com4');
fopen(s);
i = 1;
while(1)
data(i)= str2double(fscanf(s));
plot(data);
title('Temperature Monitoring')
xlabel('Time')
ylabel('Temperature')
pause(15);
i=i+1;
%thingSpeakWrite(1463959,data,'WriteKey','9OUSQA9OXZU0EO4X')
% Generate timestamps for the data
%tStamps = datetime('now')-minutes(9):minutes(1):datetime('now');
channelID = 1463959; % Change to your Channel ID
writeKey = 'xxxxxxxxxxxxxxxx'; % Change to your Write API Key
% Write 10 values to each field of your channel along with timestamps
tStamp = datetime('now')
thingSpeakWrite(1463959,data,'WriteKey','xxxxxxxxxxxxxxx','TimeStamp',tStamp)
end

Answers (0)

Communities

More Answers in the  ThingSpeak Community

Categories

Find more on Read Data from Channel in Help Center and File Exchange

Products


Release

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!