%% Extract Regions of Interest from Data Set
% Consider a set of temperature data collected by a thermometer inside an office building for four months. The device takes a reading every half hour. The sample rate is thus 48 measurements/day. Convert the temperature to degrees Celsius and plot the data.

load officetemp

tempC = (temp-32)*5/9;

fs = 48;
t = (0:length(tempC) - 1)/fs;

plot(t,tempC)
xlabel('Time (days)')
ylabel('Temperature ( {}^\circC )')

% Create region-of-interest limits that separate the temperature data into 30-day periods.

roilims = [1 30;31 60;61 90;91 120];

% Extract the regions of interest. Compute the mean temperature of each period and display the values.

sigroi = extractsigroi(tempC,roilims);

cellfun(@mean,sigroi)'

% Copyright 2020 The MathWorks, Inc.