Vector loading with constraint and saving in vector

1 visualización (últimos 30 días)
Daeyeon Koh
Daeyeon Koh el 31 de Ag. de 2021
Comentada: Daeyeon Koh el 31 de Ag. de 2021
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

Respuesta aceptada

Chunru
Chunru el 31 de Ag. de 2021
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

Más respuestas (0)

Etiquetas

Productos


Versión

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by