make list with columnames

12 次查看(过去 30 天)
Brecht Leenmans
Brecht Leenmans 2018-4-11
Is there a proper way to make a list with the columnnames of a table?
  2 个评论
Adam
Adam 2018-4-11
A list in what context? In a UI? On the command line? Saved to file?
Brecht Leenmans
Brecht Leenmans 2018-4-11
list = {'column names of the table'};
[indx,tf] = listdlg('ListString',list);

请先登录,再进行评论。

回答(1 个)

Akira Agata
Akira Agata 2018-4-17

Column names of your table, say T, can be extracted by T.Properties.VariableNames. The following is a simple example.

% Sample table
load patients
T = table(Gender,Age,Height,Weight,Smoker,Systolic,Diastolic);
% Extract column names and save as 'list'
list = T.Properties.VariableNames;

类别

Help CenterFile Exchange 中查找有关 Tables 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by