make list with columnames

12 vues (au cours des 30 derniers jours)
Brecht Leenmans
Brecht Leenmans le 11 Avr 2018
Is there a proper way to make a list with the columnnames of a table?
  2 commentaires
Adam
Adam le 11 Avr 2018
A list in what context? In a UI? On the command line? Saved to file?
Brecht Leenmans
Brecht Leenmans le 11 Avr 2018
list = {'column names of the table'};
[indx,tf] = listdlg('ListString',list);

Connectez-vous pour commenter.

Réponses (1)

Akira Agata
Akira Agata le 17 Avr 2018

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;

Catégories

En savoir plus sur Tables dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by