isletter true false
1 次查看(过去 30 天)
显示 更早的评论
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?
0 个评论
采纳的回答
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.
0 个评论
更多回答(2 个)
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
2011-10-15
Wayne, you need to scroll down a bit to see the relevant section he is asking about.
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.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Maintain or Transition figure-Based Apps 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!