How to create a vector?

조회 수: 3 (최근 30일)
Ioana Mateescuu
Ioana Mateescuu 2019년 1월 21일
댓글: Stephen23 2019년 1월 22일
How can I create a vector containing all the k values? Thank you!
beat_count=0;
for k=2:length(val)-1;
if(val(k)>val(k-1)&val(k)>val(k+1)&val(k)>1)
k
disp('Prominant peak found');
beat_count=beat_count+1;
end
end

채택된 답변

Kevin Phung
Kevin Phung 2019년 1월 21일
v = [];
for k=2:length(val)-1;
if(val(k)>val(k-1)&val(k)>val(k+1)&val(k)>1)
k
disp('Prominant peak found');
beat_count=beat_count+1;
v(end+1) = k % save k value into vector v;
end
end
  댓글 수: 2
Ioana Mateescuu
Ioana Mateescuu 2019년 1월 21일
Thank you!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Descriptive Statistics에 대해 자세히 알아보기

제품


릴리스

R2007b

Community Treasure Hunt

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

Start Hunting!

Translated by