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

10 vues (au cours des 30 derniers jours)
Alireza Majzoobi
Alireza Majzoobi le 7 Oct 2013
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 commentaire
Roger Stafford
Roger Stafford le 7 Oct 2013
Modifié(e) : Roger Stafford le 7 Oct 2013
Use matlab's 'repmat' function. See its documentation at:
http://www.mathworks.com/help/matlab/ref/repmat.html

Connectez-vous pour commenter.

Réponses (1)

Walter Roberson
Walter Roberson le 7 Oct 2013
H = blanks(100) .';
H(:) = 'A';
  2 commentaires
Andrei Bobrov
Andrei Bobrov le 7 Oct 2013
Like written Roger in comment:
repmat('A',100,1)
Walter Roberson
Walter Roberson le 7 Oct 2013
Yes, I am presenting an alternative. There are other methods as well, such as
H = char('A' * ones(100,1));

Connectez-vous pour commenter.

Catégories

En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by