Create string of dots characters

2 ビュー (過去 30 日間)
ELI
ELI 2014 年 1 月 7 日
コメント済み: Jos (10584) 2014 年 1 月 7 日
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 日
Use repmat:
repmat('.', 1, 10)

その他の回答 (1 件)

David Sanchez
David Sanchez 2014 年 1 月 7 日
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.

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

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by