isletter true false

4 visualizaciones (últimos 30 días)
Tor Fredrik Hove
Tor Fredrik Hove el 15 de Oct. de 2011
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?

Respuesta aceptada

per isakson
per isakson el 15 de Oct. de 2011
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.

Más respuestas (2)

Wayne King
Wayne King el 15 de Oct. de 2011
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 comentarios
the cyclist
the cyclist el 15 de Oct. de 2011
Wayne, you need to scroll down a bit to see the relevant section he is asking about.
Wayne King
Wayne King el 15 de Oct. de 2011
@cyclist, :) oh I see

Iniciar sesión para comentar.


the cyclist
the cyclist el 15 de Oct. de 2011
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 comentario
Tor Fredrik Hove
Tor Fredrik Hove el 15 de Oct. de 2011
thank you for alll ansers all were great!

Iniciar sesión para comentar.

Categorías

Más información sobre File Name Construction en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by