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

10 views (last 30 days)
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 Comment
Roger Stafford
Roger Stafford on 7 Oct 2013
Edited: Roger Stafford on 7 Oct 2013
Use matlab's 'repmat' function. See its documentation at:
http://www.mathworks.com/help/matlab/ref/repmat.html

Sign in to comment.

Answers (1)

Walter Roberson
Walter Roberson on 7 Oct 2013
H = blanks(100) .';
H(:) = 'A';
  2 Comments
Walter Roberson
Walter Roberson on 7 Oct 2013
Yes, I am presenting an alternative. There are other methods as well, such as
H = char('A' * ones(100,1));

Sign in to comment.

Categories

Find more on Creating and Concatenating Matrices in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!