Create string of dots characters

1 visualización (últimos 30 días)
ELI
ELI el 7 de En. de 2014
Comentada: Jos (10584) el 7 de En. de 2014
Hi,
I want to create a string of dots character like the function blanks does to create spaces. how do I do that?

Respuesta aceptada

Simon
Simon el 7 de En. de 2014
Use repmat:
repmat('.', 1, 10)

Más respuestas (1)

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

Iniciar sesión para comentar.

Categorías

Más información sobre Characters and Strings en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by