Effacer les filtres
Effacer les filtres

Run a for loop for three different types of excitation

2 vues (au cours des 30 derniers jours)
Tom
Tom le 19 Mar 2012
I need to run a for loop for three different scenarios. I tried this: -
etyp = 3 %number of excitation types
for i = 1:etyp
if i = 1
excitation = 'noise';
end
if (i = 2)
excitation = 'mls';
end
if (i = 3)
excitation = 'sweptsine';
end
end
but I get an error that I don't understand. Could anyone explain what's wrong with this code? Thanks
  1 commentaire
Matt Fig
Matt Fig le 2 Nov 2012
Tom's question
I need to run a for loop for three different scenarios. I tried this: -
etyp = 3 %number of excitation types
for i = 1:etyp
if i = 1
excitation = 'noise';
end
if (i = 2)
excitation = 'mls';
end
if (i = 3)
excitation = 'sweptsine';
end
end
but I get an error that I don't understand. Could anyone explain what's wrong with this code? Thanks

Connectez-vous pour commenter.

Réponse acceptée

Tom
Tom le 19 Mar 2012
worked it out
equals signs for the ifs need to be doubles i.e. ==

Plus de réponses (0)

Catégories

En savoir plus sur Startup and Shutdown dans Help Center et File Exchange

Tags

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by