Suppose I have a table T about New York with variables a,b,c.... I would like to rename all variables in T as 'NYa",'NYb',.... etc without renaming variables one by one. Please advise.

 채택된 답변

Walter Roberson
Walter Roberson 2018년 6월 6일

0 개 추천

T.Properties.VariableNames = cellfun(@(S) ['NY', S], T.Properties.VariableNames', 'Uniform', 0);

댓글 수: 1

Peter Perkins
Peter Perkins 2018년 6월 8일
insertBefore({'a' 'b'},1,'NY') (or strcat('NY',t.Properties.VariableNames) before R2016b-ish, I forget exactly when) would also do the trick.

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 MATLAB에 대해 자세히 알아보기

제품

태그

질문:

2018년 6월 6일

댓글:

2018년 6월 8일

Community Treasure Hunt

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

Start Hunting!

Translated by