% Channel ID to read data from readChannelID = 117***; % Temperature Field ID TemperatureFieldID = 3; % Channel Read API Key % If your channel is private, then enter the read API % Key between the '' below: readAPIKey = 'N7G********EMYID'; % TODO - Replace the [] with channel ID to write data to: writeChannelID = 182***; % TODO - Enter the Write API Key between the '' below: writeAPIKey = '5M8********5L2F'; %Temperature field to write to [tempC, timeStamp] = thingSpeakRead(readChannelID, 'Fields', TemperatureFieldID, 'numMinutes', 1440, 'ReadKey', readAPIKey); % Calculate the mimium temperature [minTempC, minTempIndex] = min(tempC); % Choose the timestamp at which the maximum temperature was measured timeMinTemp = timeStamp(minTempIndex); display(minTempC, 'Minimum Temperature for the last 24 hours is'); % Write the maximum temperature to another channel specified by the % 'writeChannelID' variable display(['Note: To successfully write data to another channel, ',... 'assign the write channel ID and API Key to ''writeChannelID'' and ',... '''writeAPIKey'' variables above. Also uncomment the line of code ',... 'containing ''thingSpeakWrite'' (remove ''%'' sign at the beginning of the line.)']) % Learn more about the THINGSPEAKWRITE function by going to the Documentation tab on % the right side pane of this page. thingSpeakWrite(writeChannelID, minTempC, 'timestamp', timeMinTemp, 'fields', 6, 'Writekey', writeAPIKey);