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

per isakson
per isakson 2017년 11월 2일
편집: per isakson 2017년 11월 2일
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.
Thank you, this will work.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Data Type Conversion에 대해 자세히 알아보기

태그

질문:

2017년 11월 1일

댓글:

2017년 11월 2일

Community Treasure Hunt

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

Start Hunting!

Translated by