Clear Filters
Clear Filters

How to create a vector?

2 views (last 30 days)
Ioana Mateescuu
Ioana Mateescuu on 21 Jan 2019
Commented: Stephen23 on 22 Jan 2019
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

Accepted Answer

Kevin Phung
Kevin Phung on 21 Jan 2019
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

More Answers (0)

Categories

Find more on Curve Fitting Toolbox in Help Center and File Exchange

Products


Release

R2007b

Community Treasure Hunt

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

Start Hunting!