Producing outputs from loop

1 回表示 (過去 30 日間)
sam van Bohemen
sam van Bohemen 2019 年 11 月 20 日
コメント済み: sam van Bohemen 2019 年 11 月 20 日
I have a matrix (xMatrix: 128 x 1068). I want to run my find peak code for all 1068 columns of the matrix to calculate the peak amplitude mean, peak amplitude std dev and number of peaks for each column. How can I do this so I create a new matrix (1068 x 3) displaying all these values for each coulmn?
Here is my find peak code:
for N=(1:1068)
[pks,locs]=findpeaks(xMatrix(:,N),'MinPeakDistance',20,'MinPeakHeight',750);
B=rmoutliers(pks,'mean');
[B,TF]=rmoutliers(pks);
peakampmean=mean(B);
peakstd=std(B);
numpeaks=numel(B);
end
Thanks
Sam

採用された回答

Erivelton Gualter
Erivelton Gualter 2019 年 11 月 20 日
for N=1:1068
[pks,locs] = findpeaks(xMatrix(:,N),'MinPeakDistance',20,'MinPeakHeight',750);
B = rmoutliers(pks,'mean');
[B,TF] = rmoutliers(pks);
peakampmean = mean(B);
peakstd = std(B);
numpeaks = numel(B);
% New Matrix
newMatrix(1,N) = peakampmean;
newMatrix(2,N) = peakstd;
newMatrix(3,N) = numpeaks;
end
  1 件のコメント
sam van Bohemen
sam van Bohemen 2019 年 11 月 20 日
Thanks again for your help!!!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDescriptive Statistics についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by