필터 지우기
필터 지우기

Data set must contain at least 3 samples when Using findpeaks()

조회 수: 7 (최근 30일)
R
R 2022년 5월 24일
댓글: Walter Roberson 2022년 5월 24일
When the below code was used with a different set of data, it worked fine but when I use a different set, it gives the following error:
Data set must contain at least 3 samples.
There is more than enough data (over 1 million) so this shouldn't be a problem. How should I go about fixing this?
start_time = filteredTT.x(1);
end_time = filteredTT.x(end);
interval = minute(1);
idx1 = start_time;
breathingRate = [];
time = [];
while idx1 < filteredTT.x(end)
range = timerange(idx1, "minutes");
data = table2array(filteredTT(range,:));
timeperiod = (filteredTT.x(range));
[pks, loc] = findpeaks(data, timeperiod, "MinPeakDistance", seconds(3));
numOfPeaks = size(pks,1);
breathingRate(end+1) = numOfPeaks;
idx1 = idx1 + minutes(1);
end
  댓글 수: 3
R
R 2022년 5월 24일
Thank you for your comment. The number of columns are always the same. The only thing changing is the number of rows for the data that is being passed.
Walter Roberson
Walter Roberson 2022년 5월 24일
you would get that if there is any location in the data with fewer than 3 entries in the same minute.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Descriptive Statistics에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by