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 (최근 30일)
I have one column with many names. I want to add a T to every name. How can I do that?

채택된 답변

Walter Roberson
Walter Roberson 2022년 10월 6일
%build an example table
sourceletters = 'A':'P';
FirstColumn = string( sourceletters(randi(numel(sourceletters), 5, 7)));
T = table(FirstColumn)
T = 5×1 table
FirstColumn ___________ "MJKGICH" "CDHIOFN" "PKNLFOI" "LDOMKPF" "MNCMDKK"
%now do the work
T.TBefore = "T" + T.FirstColumn;
T.TAfter = T.FirstColumn + "T";
T
T = 5×3 table
FirstColumn TBefore TAfter ___________ __________ __________ "MJKGICH" "TMJKGICH" "MJKGICHT" "CDHIOFN" "TCDHIOFN" "CDHIOFNT" "PKNLFOI" "TPKNLFOI" "PKNLFOIT" "LDOMKPF" "TLDOMKPF" "LDOMKPFT" "MNCMDKK" "TMNCMDKK" "MNCMDKKT"
  댓글 수: 4
Jose Mendoza Garcia
Jose Mendoza Garcia 2022년 10월 6일
I have two tables on matlab. The tables have an identical column 1 and variables. what i want to do is the following:
I want to combine row 1 of table 1 and row 1 of table two. Then i want to do a t test. The tables have 17 columns and i want to do the same for each one. Can you please help me?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 LaTeX에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by