How do I generate a string during a loop

I'm looking to generate a string, such as 'grape', when a certain value, say, 0.5, is encountered during a loop. How do I do this?

3 comentarios

per isakson
per isakson el 2 de Nov. de 2017
Editada: per isakson el 2 de Nov. de 2017
if abs( certain_value - 0.5 ) <= eps( certain_value )
grape = 'Cabernet Sauvignon';
end
if value==0.5
'grape'
end
If you want to actually do something with it, save it in a variable. Not sure what you want to do with the 'grape' string.
Kevin  Hartman
Kevin Hartman el 2 de Nov. de 2017
Thank you, this will work.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Data Type Conversion en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 1 de Nov. de 2017

Comentada:

el 2 de Nov. de 2017

Community Treasure Hunt

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

Start Hunting!

Translated by