필터 지우기
필터 지우기

Vector loading with constraint and saving in vector

조회 수: 1 (최근 30일)
Daeyeon Koh
Daeyeon Koh 2021년 8월 31일
댓글: Daeyeon Koh 2021년 8월 31일
Hi.
I found, and saved peaks information in vector in the cell 'A' with 'findpeaks' function.
And I could see the saved vector array.
I'd like to collect the peak vectors in the range (1<loc<10).
But with this script, I can only get peak values(pks) in the 'B' cell, not vector([pks, locs]).
How can I save disirable vectors in the cell 'B'?
clc;
clear all;
[numbers,strings,raw]=xlsread('C:\Users\marett\Desktop\0310 FFT');
[row, col]=size(numbers);
numArrays = row-2;
A=cell(numArrays,2);
B=cell(numArrays,2);
x=numbers(:,2);
for n=1:col
y=numbers(:,n+2);
ys=smooth(y,50,'sgolay',5);
[pks,locs] = findpeaks(ys,x,'MinPeakDistance',0.5);
A{n}=[pks,locs];
B{n}=A{n}(locs>1&locs<10);
end

채택된 답변

Chunru
Chunru 2021년 8월 31일
clc;
clear all;
[numbers,strings,raw]=xlsread('C:\Users\marett\Desktop\0310 FFT');
[row, col]=size(numbers);
numArrays = row-2;
A=cell(numArrays,2);
B=cell(numArrays,2);
x=numbers(:,2);
for n=1:col
y=numbers(:,n+2);
ys=smooth(y,50,'sgolay',5);
[pks,locs] = findpeaks(ys,x,'MinPeakDistance',0.5);
A{n}=[pks,locs];
B{n}=A{n}(locs>1&locs<10, :); % Add ", :" here
end

추가 답변 (0개)

카테고리

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

태그

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by