Hi, why doesnt 'works' show when i run this? Is it because the case has to be the switch input?
inStr='d'
switch inStr
case inStr(1)=='d'
outStr='works'
otherwise
'error'
end

 Respuesta aceptada

Walter Roberson
Walter Roberson el 8 de Oct. de 2017

0 votos

case inStr(1)=='d' evaluates inStr(1)=='d', generating the value false or true. That value is then compared to inStr because of switch inStr, and is found to not equal to inStr.
switch inStr(1)
case 'd'

Más respuestas (0)

Categorías

Más información sobre Operators and Elementary Operations en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 8 de Oct. de 2017

Editada:

el 8 de Oct. de 2017

Community Treasure Hunt

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

Start Hunting!

Translated by