필터 지우기
필터 지우기

isletter true false

조회 수: 1 (최근 30일)
Tor Fredrik Hove
Tor Fredrik Hove 2011년 10월 15일
How does isletter work here. Is it the value 1 that makes it executable and the value 0 that makes it not excecute and go to else?

채택된 답변

per isakson
per isakson 2011년 10월 15일
isletter is a function, which returns a logical value. The logical values, true and false, are displayed as 1 and 0, respectively by Matlab. Test by running
class( isletter('a'))
Thus, you may read "if true" execute the if-clause else execute the else-clause.

추가 답변 (2개)

Wayne King
Wayne King 2011년 10월 15일
I don't see isletter() in what you've posted. I see an if statement based on the output of menu()
The menu() call you show outputs a 1,2,or 3 based on what the user selects. 1 for Cheese, 2 for Shroom, and 3 for Sausage.
If the user were to simply kill the figure window, then output would be 0.
  댓글 수: 2
the cyclist
the cyclist 2011년 10월 15일
Wayne, you need to scroll down a bit to see the relevant section he is asking about.
Wayne King
Wayne King 2011년 10월 15일
@cyclist, :) oh I see

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


the cyclist
the cyclist 2011년 10월 15일
Basically, yes. "1" is a representation of the boolean "true", and "0" is a representation of the boolean "false". So, "if 1" means "if true", and the statement executes accordingly.
  댓글 수: 1
Tor Fredrik Hove
Tor Fredrik Hove 2011년 10월 15일
thank you for alll ansers all were great!

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

카테고리

Help CenterFile Exchange에서 File Name Construction에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by