Find matched string in table
Mostrar comentarios más antiguos
Hi,
To find data matching certain conditions in a table we use:
rows = (T.Smoker==true & T.Age<40);
What if the T.Smoker field was not a logical but a string? 'yes' or 'no'.
rows = (T.Smoker=='yes' & T.Age<40);
This later code does not work. How could I make it work so the condition matches a certain string?
Thank you,
TD
Respuesta aceptada
Más respuestas (2)
Fangjun Jiang
el 9 de Mzo. de 2020
isequal(T.Smoker, 'yes')
strcmpi(T.Smoker, 'yes')
1 comentario
The Finnish Rein Deer
el 10 de Mzo. de 2020
Image Analyst
el 9 de Mzo. de 2020
Try contains:
rows = contains(T.Smoker, 'yes') & T.Age<40;
1 comentario
The Finnish Rein Deer
el 10 de Mzo. de 2020
Categorías
Más información sobre Characters and Strings en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!