another quick question about string read

1 回表示 (過去 30 日間)
UTA
UTA 2013 年 2 月 13 日
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 件のコメント
Jan
Jan 2013 年 2 月 13 日
@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 日
EDIT
sprintf('%s_%d', 'modelsq', gesNum);
  2 件のコメント
UTA
UTA 2013 年 2 月 13 日
it is not work, it only shows modelsq_
José-Luis
José-Luis 2013 年 2 月 13 日
My bad, forgot to change the integer identifier, please try:
gesNum = 6;
sprintf('%s_%i', 'modelsq', gesNum);

サインインしてコメントする。

その他の回答 (1 件)

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 2 月 13 日
sprintf('modelsq_%d', gesNum);

カテゴリ

Help Center および File ExchangeMultidimensional Arrays についてさらに検索

タグ

タグが未入力です。

Community Treasure Hunt

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

Start Hunting!

Translated by