%% Write a Matrix of Data
% Write a matrix of data to the first three fields of a channel. The timestamps provided are interpreted as local time.

% Generate Random Data
data = randi(10,10,3);

% Generate timestamps for the data
tStamps = datetime('now')-minutes(9):minutes(1):datetime('now');

channelID = 17504; % Change to your Channel ID
writeKey = '23ZLGOBBU9TWHG2H'; % Change to your Write API Key

% Write 10 values to each field of your channel along with timestamps
thingSpeakWrite(channelID,data,'TimeStamp',tStamps,'WriteKey',writeKey)

%
% Copyright 2018 The MathWorks, Inc.