Effacer les filtres
Effacer les filtres

Creating a char matrix

30 vues (au cours des 30 derniers jours)
chaos4u2
chaos4u2 le 11 Fév 2013
I need to build a char matrix, for example:
A = [31T 31T 31T ...] Of dimensions 1514443x1 full of '31T'.
I would write: for i=1:1514443; A(i,1)='31T'; end
But I get the mistake: Assignment has more non-singleton rhs dimensions than non-singleton subscripts
I don't know what to do. Please help me.

Réponse acceptée

José-Luis
José-Luis le 11 Fév 2013
Modifié(e) : José-Luis le 11 Fév 2013
your_mat = repmat('31T',15443,1);
Note that the dimensions of this array will be 15443 times 3 (the number of characters in the string. If you really want a 1 as the second dimension then you could use a cell array:
your_mat = repmat({'31T'},15443,1);
  2 commentaires
chaos4u2
chaos4u2 le 12 Fév 2013
Thank you!!
José-Luis
José-Luis le 12 Fév 2013
My pleasure

Connectez-vous pour commenter.

Plus de réponses (1)

Azzi Abdelmalek
Azzi Abdelmalek le 11 Fév 2013
s='31T'
out=repmat(s,1514443,1)
  1 commentaire
chaos4u2
chaos4u2 le 11 Fév 2013
Thank you very much!!!! Problem solved!

Connectez-vous pour commenter.

Catégories

En savoir plus sur Data Types 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