VariableNames for table that begins with number

I have matrix like this
A =[4 1 0 0;5 0 1 1;6 1 0 1; 7 0 1 0];
I want to make a table with this variable name
Var_name = {[1,3,4],[4,7,8],[1,2]};
The result should be
index [1,3,4] [4,7,8] [1,2]
4 1 0 0
5 0 1 1
6 1 0 1
7 0 1 0
I used this code
T = array2table(A,'VariableNames',{'index' '{1,3,4}' '{4,7,8}' '{1,2}'});
But it does not work.

댓글 수: 2

A =[4 1 0 0;5 0 1 1;6 1 0 1; 7 0 1 0];
T = array2table(A,'VariableNames',{'index' '{1,3,4}' '{4,7,8}' '{1,2}'});
T
T = 4×4 table
index {1,3,4} {4,7,8} {1,2} _____ _______ _______ _____ 4 1 0 0 5 0 1 1 6 1 0 1 7 0 1 0
It is working...what version you are using?
NA
NA 2021년 6월 2일
Thank you

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

 채택된 답변

Steven Lord
Steven Lord 2021년 6월 2일

0 개 추천

The ability to use table variable names that are not valid MATLAB variable names was introduced in release R2019b.

추가 답변 (0개)

카테고리

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

질문:

NA
2021년 6월 2일

댓글:

NA
2021년 6월 2일

Community Treasure Hunt

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

Start Hunting!

Translated by