Vector loading with constraint and saving in vector
조회 수: 1 (최근 30일)
이전 댓글 표시
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
댓글 수: 0
채택된 답변
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개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!