MATLAB: How can i create a table

table

For example:
a=2; b=6; c=;8 I would like to create a table like
Times Frequency Value
--------------------------------
2 6 8

Best Answer

fprintf('%-20s %-20s %-20s\n', 'Times', 'Frequency', 'Value');
fprintf('%s\n', repmat('-', 1, 20*3+2));
fprintf('%-20d %-20d %-20d\n', a, b, c);
Output is
Times Frequency Value
--------------------------------------------------------------
2 6 8