How to create a vector?

6 次查看(过去 30 天)
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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

产品


版本

R2007b

Community Treasure Hunt

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

Start Hunting!

Translated by