Introduce columns in a table- Variables
이전 댓글 표시
Hi, I want to introduce columns in a table, then I write Table.a but a is a variable string and I want that the column has the name of this string how I can do that???
채택된 답변
추가 답변 (1개)
the cyclist
2017년 2월 7일
% Create the table
x = rand(3,1);
tbl = table(x);
% Create the string that contains the variable name
varString = 'x';
% Access that variable, using the string
tbl(:,varString)
댓글 수: 2
Patrick Brown
2017년 2월 8일
the cyclist
2017년 2월 8일
This is also possible:
% Create the string that contains the variable name
varString = {'velocity'};
% Create the table with the name
x = rand(3,1);
tbl = table(x,'VariableName',varString);
카테고리
도움말 센터 및 File Exchange에서 Tables에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!