make a matrix with size 100 x 1 with the same elements

I wanna to make a matrix with size 100 x 1 which all its elements are " A " ( character) ?
the same as this:
H=['A';'A';'A';'A'............];

댓글 수: 1

Use matlab's 'repmat' function. See its documentation at:
http://www.mathworks.com/help/matlab/ref/repmat.html

댓글을 달려면 로그인하십시오.

답변 (1개)

Walter Roberson
Walter Roberson 2013년 10월 7일
H = blanks(100) .';
H(:) = 'A';

댓글 수: 2

Like written Roger in comment:
repmat('A',100,1)
Yes, I am presenting an alternative. There are other methods as well, such as
H = char('A' * ones(100,1));

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

질문:

2013년 10월 7일

댓글:

2013년 10월 7일

Community Treasure Hunt

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

Start Hunting!

Translated by