MATLAB: Spaces between columns, or, table format. How to assemble the table

spaces between columns

Well, I'm not a supporter of tables, only when I do exams. But please tell me how to format a table with several titles and columns, such as: Column 26 Column 43 Column 7. And below the row of titles, the values or the columns' numbers n * 1. It is because, for me, it's a bit difficult to understand, in the 'table help'. Thanks for your help. REGARDS

Best Answer

Yor can use the following command to create a table with m rows and n columns.

t = cell2table(cell(m, n));

You can specify the name of rows and columns of the table using t.Properties.RowNames and t.Properties.VariableNames respectively. For doing what you want, you can do it like this,

for i=1:length(q.Properties.VariableNames)
  q.Properties.VariableNames{i} = strcat('Column ', num2str(i));
end

It will name all columns as Column 1, column 2, ...., Column n.