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 CenterFile Exchange에서 Descriptive Statistics에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by