필터 지우기
필터 지우기

Run a for loop for three different types of excitation

조회 수: 2 (최근 30일)
Tom
Tom 2012년 3월 19일
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에서 Startup and Shutdown에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by