how to get a column name of atable in matlab

You can get the column names of a table in MATLAB by using the table.Properties.VariableNames property. Here's an example:

main.m
% create a sample table
T = table(rand(3,1), rand(3,1), rand(3,1), 'VariableNames', {'Var1', 'Var2', 'Var3'});

% get the column names
column_names = T.Properties.VariableNames
177 chars
6 lines

This will give you an output like:

main.m
column_names =

  1×3 cell array

    {'Var1'}    {'Var2'}    {'Var3'}
71 chars
6 lines

So in this case the column names are Var1, Var2 and Var3.

related categories

gistlibby LogSnag