Run a for loop for three different types of excitation

2 次查看(过去 30 天)
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 个评论
Matt Fig
Matt Fig 2012-11-2
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

请先登录,再进行评论。

采纳的回答

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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Measurements and Spatial Audio 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by