how to apply code some interval columns

4 ビュー (過去 30 日間)
HAN TAEHEE
HAN TAEHEE 2020 年 10 月 14 日
回答済み: Ameer Hamza 2020 年 10 月 14 日
I want to apply this code some interval of data
envelope(data,1,'peak')
[peakHeights,valleyHeights] = envelope(data,1,'peak')
vi = sum(peakHeights-valleyHeights)
[peakHeights, indexesOfPeaks] = findpeaks (data);
[valleyHeights, indexesOfValleys] = findpeaks (data);
fi = numel(indexesOfPeaks) + numel(indexesOfValleys)
for example
if data set is [ 1 2 3 4 4 3 5 3 2 3 5 6 7 7 3 5 6 7 1 9 2 4 6 7 8 8 4 3 2 2 5 5 ]
i want apply this code some interval (if 3 column ) like [1 2 3], [2 3 4], [3 4 4], [4,4,3].....[2 5 5] moving forward 1 colmumn.
so, i want to know how to apply code to some interval ( in here 3 column) in moving 1 column forward.
please let me know, thank you

採用された回答

Ameer Hamza
Ameer Hamza 2020 年 10 月 14 日
You can write a for-loop
x = [ 1 2 3 4 4 3 5 3 2 3 5 6 7 7 3 5 6 7 1 9 2 4 6 7 8 8 4 3 2 2 5 5 ];
n = 3;
for i = 1:numel(x)-n+1
xi = x(i:i+2); % n-element vector
% process xi
end

その他の回答 (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