% Plot sensors from multiple channels % Karl Berger % 27 May 2016 % Channel IDs to read data from ChannelID1 = 123792; ChannelID2 = 64954; ChannelID3 = 88666; ChannelID4 = 64954; % Sensor Field IDs sensorFieldID_Ch1 = 1; sensorFieldID_Ch2 = 1; sensorFieldID_Ch3 = 1; sensorFieldID_Ch4 = 1; % Names for Channels nameCh1 = 'Alpha'; nameCh2 = 'Bravo'; nameCh3 = 'Charlie'; nameCh4 = 'Delta'; dataPoints = 100; % Read time and sensor data for Channel 1 [sensorCh1Data, time] = thingSpeakRead(ChannelID1, 'Fields', sensorFieldID_Ch1, 'NumPoints', dataPoints); % Read sensor data for Channel 2 sensorCh2Data = thingSpeakRead(ChannelID2, 'Fields', sensorFieldID_Ch2, 'NumPoints', dataPoints); % Read sensor data for Channel 3 sensorCh3Data = thingSpeakRead(ChannelID3, 'Fields', sensorFieldID_Ch3, 'NumPoints', dataPoints); % Read sensor data for Channel 4 sensorCh4Data = thingSpeakRead(ChannelID4, 'Fields', sensorFieldID_Ch4, 'NumPoints', dataPoints); % plot data for each channel against time from Channel 1 thingSpeakPlot(time, [sensorCh1Data, sensorCh2Data, sensorCh3Data, sensorCh4Data], 'ylabel','Temperature (°C)',... 'legend', {nameCh1, nameCh2, nameCh3, nameCh4}, 'Grid', 'on', 'linewidth', 2);