I want to create a string that contains 2767 letters (1000 times s). Is there any way to do that fast without typing 'sssss..' 2000 times? thank you

1 回表示 (過去 30 日間)
I want to create a string that contains 2767 letters (1000 times s). Is there any way to do that fast without typing 'sssss..' 2000 times?
thank you
  2 件のコメント
Jan
Jan 2013 年 4 月 2 日
I cannot understand, why 2767 letters can be "1000 times s", or why you type 2000 times. I would expect than 2767 letters are e.g. 2767 times 's' or that you type 's' 2767 times.
Walter Roberson
Walter Roberson 2013 年 4 月 2 日
Do you mean that 1000 of the 2767 are 's' and the other 1767 are some other characters? If so, which other characters? What order do the characters need to be in?

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

採用された回答

José-Luis
José-Luis 2013 年 4 月 2 日
編集済み: José-Luis 2013 年 4 月 2 日
your_str = repmat('s',1,2767);
Or
your_str(1:2767)='s';
Amongst other options.

その他の回答 (1 件)

Aubrey
Aubrey 2013 年 4 月 2 日
Hello alexandra
Have you considered using a loop?
You can use a for-loop that repeats 2767 times. Create a string variable and then use the for-loop to add a letter into that variable each time it repeats. That should do the trick! Good luck

カテゴリ

Help Center および File ExchangeCharacters and Strings についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by