Consider a two-column matrix representing possible regions of interest of a 45-sample random signal. Extract the signal samples corresponding to the regions of interest.

Consider a set of temperature data collected by a thermometer inside an office building for about 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.

Consider a two-column matrix representing possible regions of interest of a 45-sample random signal. Extract the signal samples corresponding to the regions of interest. Concatenate the samples into a single vector.

Plot the signal and highlight the regions of interest.

plot(x)
y = NaN(size(x));
for kj = 1:size(roilims,1)
roi = roilims(kj,1):roilims(kj,2);
y(roi) = sigroi(1:length(roi));
sigroi(1:length(roi)) = [];
end
hold on
plot(y)
hold off

Extract and Concatenate 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.

load officetemp
tempC = (temp-32)*5/9;
fs = 48;

Create region-of-interest (ROI) limits that correspond to five random two-week periods separated by at least 24 hours. Use the temperature readings from these days for an audit.

r = 5;
w = 14*fs;
s = 1*fs;
hq = histcounts(randi(r+1,1,length(tempC)-r*w-(r-1)*s),(1:r+2)-1/2);
t = (1 + (0:r-1)*(w+s) + cumsum(hq(1:r)))';
roilims = [t t+w-1];

Extract the regions of interest. Compute the mean temperature of each audited region of interest and display the values.

Example: chirp(0:1/1e3:1,25,1,50) specifies a chirp sampled at 1
kHz.

Data Types: single | double Complex Number Support: Yes

roilims — Region-of-interest limits two-column matrix of positive integers

Region-of-interest limits, specified as a two-column matrix of positive integers. The
ith row of roilims contains nondecreasing
indices corresponding to the beginning and end samples of the ith
region of interest of a signal.

Example: [5 8; 12 20; 18 25] specifies a two-column region-of-interest
matrix with three regions.

sigroi — Signal regions of interest cell array | vector

Signal regions of interest, returned as a cell array or a vector.

If concat is set to false,
sigroi is a cell array. The ith cell of
sigroi contains the signal samples corresponding to the
ith region of interest specified in
roilims.

If concat is set to true,
sigroi is a vector that concatenates all extracted signal
samples.

Extended Capabilities

C/C++ Code Generation Generate C and C++ code using MATLAB® Coder™.

You can also select a web site from the following list:

How to Get Best Site Performance

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.