How to create structure with while loop?

조회 수: 1 (최근 30일)
Vy Nguyen
Vy Nguyen 2015년 10월 14일
답변: Muthu Annamalai 2015년 10월 29일
Hello,
I don't understand what my instructor means by this, can someone explain for me? Thanks!
Create a script containing a while loop that checks for a yes response to continue (we did this in class – you must set an initial “answer” to ‘y’ at the beginning of the loop, then take a character input at the end of everything to check for exiting. Use strcmpi to compare the “answer” to ‘y’).
  댓글 수: 1
James Tursa
James Tursa 2015년 10월 14일
Please post what you have done so far and then ask specific questions about where you are having trouble. What does a structure have to do with the 'y' while loop?

댓글을 달려면 로그인하십시오.

답변 (1개)

Muthu Annamalai
Muthu Annamalai 2015년 10월 29일
Hello Vy, You are looking for a event loop like this,
answer = 'y'
while strcmpi(answer,'y')
%do something
answer = input('Do you want to continue (y/n) ? ','s')
end
I also recommend you look at the
help input

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by