How can I add a letter to a column of strings. For example i want all names in the column one to change to this Name T.
8 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Jose Mendoza Garcia
le 6 Oct 2022
Modifié(e) : Walter Roberson
le 6 Oct 2022
I have one column with many names. I want to add a T to every name. How can I do that?
0 commentaires
Réponse acceptée
Walter Roberson
le 6 Oct 2022
%build an example table
sourceletters = 'A':'P';
FirstColumn = string( sourceletters(randi(numel(sourceletters), 5, 7)));
T = table(FirstColumn)
%now do the work
T.TBefore = "T" + T.FirstColumn;
T.TAfter = T.FirstColumn + "T";
T
4 commentaires
Walter Roberson
le 6 Oct 2022
Modifié(e) : Walter Roberson
le 6 Oct 2022
String operations are described at https://www.mathworks.com/help/matlab/characters-and-strings.html
Table variable operations are described at https://www.mathworks.com/help/matlab/matlab_prog/add-and-delete-table-variables.html
Possibly you want innerjoin
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Tables 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!