Character String and Variables

조회 수: 7 (최근 30일)
Coulton
Coulton 2012년 9월 14일
Is there a way to call variables inside of a character string? What I would like to do is below:
Take the character string BOO and attached the numbers 1-30 based on a for loop so I get the following in character format
BOO1 BOO2 BOO3 ... BOO30
Where BOO is nothing but a string of characters.

채택된 답변

the cyclist
the cyclist 2012년 9월 14일
sprintf('BOO%d ',d)

추가 답변 (1개)

Coulton
Coulton 2012년 9월 14일
I was able to hard code my way to get this to work, but I like the sprintf() better. I was looking at that function, but I guess I didn't understand it fully. Thanks for the help!

카테고리

Help CenterFile Exchange에서 Characters and Strings에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by