How to covert rownames to the first variable in the table?
조회 수: 36 (최근 30일)
이전 댓글 표시
I have a table with rownames (nuemric value) and want to convert it to a table with a newly added variable from the rownames.
댓글 수: 0
채택된 답변
Star Strider
2023년 1월 25일
Try something like this —
T1 = array2table(randi(9, 5, 5));
T1.Properties.RowNames = {'1','2','3','4','5'} % Create Table With Row Names
RN = T1.Properties.RowNames % Get Row Names
T1 = addvars(T1, cell2mat(RN), 'Before','Var1') % Convert Row Names To First Variable
T1.Properties.RowNames = {} % Delete Original Row Names
.
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Tables에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!