Assigning Input String To Meet Criteria

2 visualizaciones (últimos 30 días)
Jose Villamil
Jose Villamil el 15 de Feb. de 2020
Comentada: Star Strider el 15 de Feb. de 2020
So to summarize briefly what i'm doing. I'm making a scripted game for matlab if you know what DnD is, the format would be very similar to that. The purpose for creating the game would be for my own leizure and allowing myself to practice matlab. I'm currently trying to create an istance were the player can choose it's gender but for reasons unknown to me the instancecant select the girl path. So i'm wondering if someone could point out what im doing wrong.

Respuesta aceptada

Star Strider
Star Strider el 15 de Feb. de 2020
The logical equality does not work with character arrays.
Use strcmp or (strcmpi) instead:
gender = 'boy';
TestLogic = strcmpi(gender, 'boy')
produces:
TestLogic =
logical
1
Good luck with your DnD game!
  2 comentarios
Jose Villamil
Jose Villamil el 15 de Feb. de 2020
Thanks so much it worked like a charm!
Star Strider
Star Strider el 15 de Feb. de 2020
As always, my pleasure!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Just for fun 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