Trouble using strings in If statements using OR
18 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Sarah R
el 20 de En. de 2022
Comentada: Stephen23
el 21 de En. de 2022
I am trying to loop through and use IF statement as example:
if race == "H2" | "H1" | "H3" | "H4"
but I get error "Error using |
Input must be text or pattern."
If I try: race == "H2" || "H1" || "H3" || "H4"
I get error:
Conversion to logical from string is not possible.
"H1" and so forth are strings in Matlab
Thank you!
Respuesta aceptada
Voss
el 20 de En. de 2022
if race == "H2" || race == "H1" || race == "H3" || race == "H4"
1 comentario
Más respuestas (0)
Ver también
Categorías
Más información sobre Characters and Strings en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!