Filter löschen
Filter löschen

Create string of dots characters

2 Ansichten (letzte 30 Tage)
ELI
ELI am 7 Jan. 2014
Kommentiert: Jos (10584) am 7 Jan. 2014
Hi,
I want to create a string of dots character like the function blanks does to create spaces. how do I do that?

Akzeptierte Antwort

Simon
Simon am 7 Jan. 2014
Use repmat:
repmat('.', 1, 10)

Weitere Antworten (1)

David Sanchez
David Sanchez am 7 Jan. 2014
function my_dots(n)
str = '';
for k=1:n
str = strcat(str,'.');
end
disp(str)
>> my_dots(3)
...
>> my_dots(10)
..........
  1 Kommentar
Jos (10584)
Jos (10584) am 7 Jan. 2014
In every iteration, str grows by one element, making this painstakingly slow with increasing n … MLint warns you for this problem.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Mathematics finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by