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.
2 views (last 30 days)
Show older comments
Jose Mendoza Garcia
on 6 Oct 2022
Edited: Walter Roberson
on 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 Comments
Accepted Answer
Walter Roberson
on 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 Comments
Walter Roberson
on 6 Oct 2022
Edited: Walter Roberson
on 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
More Answers (0)
See Also
Categories
Find more on LaTeX 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!