필터 지우기
필터 지우기

Create string of dots characters

조회 수: 1 (최근 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 CenterFile Exchange에서 Numeric Types에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by