Effacer les filtres
Effacer les filtres

How to create a vector?

2 vues (au cours des 30 derniers jours)
Ioana Mateescuu
Ioana Mateescuu le 21 Jan 2019
Commenté : Stephen23 le 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

Réponse acceptée

Kevin Phung
Kevin Phung le 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
  2 commentaires
Ioana Mateescuu
Ioana Mateescuu le 21 Jan 2019
Thank you!
Stephen23
Stephen23 le 22 Jan 2019

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Curve Fitting Toolbox dans Help Center et File Exchange

Produits


Version

R2007b

Community Treasure Hunt

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

Start Hunting!

Translated by