make a matrix with size 100 x 1 with the same elements
10 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentar
Roger Stafford
am 7 Okt. 2013
Bearbeitet: Roger Stafford
am 7 Okt. 2013
Use matlab's 'repmat' function. See its documentation at:
http://www.mathworks.com/help/matlab/ref/repmat.html
Antworten (1)
Walter Roberson
am 7 Okt. 2013
H = blanks(100) .';
H(:) = 'A';
2 Kommentare
Andrei Bobrov
am 7 Okt. 2013
Like written Roger in comment:
repmat('A',100,1)
Walter Roberson
am 7 Okt. 2013
Yes, I am presenting an alternative. There are other methods as well, such as
H = char('A' * ones(100,1));
Siehe auch
Kategorien
Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!