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 个评论
Roger Stafford
2013-10-7
编辑:Roger Stafford
2013-10-7
Use matlab's 'repmat' function. See its documentation at:
http://www.mathworks.com/help/matlab/ref/repmat.html
回答(1 个)
Walter Roberson
2013-10-7
H = blanks(100) .';
H(:) = 'A';
2 个评论
Andrei Bobrov
2013-10-7
Like written Roger in comment:
repmat('A',100,1)
Walter Roberson
2013-10-7
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!