Run a for loop for three different types of excitation

1 visualización (últimos 30 días)
Tom
Tom el 19 de Mzo. de 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 comentario
Matt Fig
Matt Fig el 2 de Nov. de 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

Iniciar sesión para comentar.

Respuesta aceptada

Tom
Tom el 19 de Mzo. de 2012
worked it out
equals signs for the ifs need to be doubles i.e. ==

Más respuestas (0)

Categorías

Más información sobre Startup and Shutdown en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by