Create string of dots characters

Hi,
I want to create a string of dots character like the function blanks does to create spaces. how do I do that?

 採用された回答

Simon
Simon 2014 年 1 月 7 日

1 投票

Use repmat:
repmat('.', 1, 10)

その他の回答 (1 件)

David Sanchez
David Sanchez 2014 年 1 月 7 日

0 投票

function my_dots(n)
str = '';
for k=1:n
str = strcat(str,'.');
end
disp(str)
>> my_dots(3)
...
>> my_dots(10)
..........

1 件のコメント

Jos (10584)
Jos (10584) 2014 年 1 月 7 日
In every iteration, str grows by one element, making this painstakingly slow with increasing n … MLint warns you for this problem.

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

カテゴリ

ヘルプ センター および File ExchangeCharacters and Strings についてさらに検索

タグ

質問済み:

ELI
2014 年 1 月 7 日

コメント済み:

2014 年 1 月 7 日

Community Treasure Hunt

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

Start Hunting!

Translated by