another quick question about string read

gesNum = 6;
I want to get modelsq_6 other than modelsq_gesNum by using : sprintf('%s_%s', 'modelsq', 'gesNum'); I know this is wrong way, so how should I do?

댓글 수: 1

@UTA: The documentation of sprintf does explain this clearly, so please read again:
help sprintf
doc sprintf

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

 채택된 답변

José-Luis
José-Luis 2013년 2월 13일
편집: José-Luis 2013년 2월 13일

1 개 추천

EDIT
sprintf('%s_%d', 'modelsq', gesNum);

댓글 수: 2

UTA
UTA 2013년 2월 13일
it is not work, it only shows modelsq_
My bad, forgot to change the integer identifier, please try:
gesNum = 6;
sprintf('%s_%i', 'modelsq', gesNum);

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

추가 답변 (1개)

카테고리

도움말 센터File Exchange에서 Characters and Strings에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

질문:

UTA
2013년 2월 13일

Community Treasure Hunt

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

Start Hunting!

Translated by