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 个)

H = blanks(100) .';
H(:) = 'A';

2 个评论

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 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by