MATLAB: How to tabulate this results using fprintf

tabulating

Hi All,
I have some results but they need to be in a tabulated form. If we say;
fprintf('n a(n) TrueValue epsilont epsilona\n');
how to tabulate this results in this format? My aim is tabulate them in a format that shows 1'st column n, second column lists a(n), third column shows TrueValue, 4'th column and 5'th column shows epsilont and epsilona respectively.
I've tried something like;
fprintf('%6.6f\n%6.6f\n%6.6f\n%6.6f\n%6.6f\n',n,a(n),TrueValue,epsilont,epsilona);
But everything appeared under one column in matlab command window.
Any Ideas?
I will appreciate for any help.
Thanks already!

Best Answer

Give some example values for your data...
Here is a generic example on how to make nice tabulations:
x = rand(5,1);
y = rand(5,1);
[r,t] = cart2pol(x,y);
fprintf('\n\n%11s%11s%11s%11s\n','x', 'y', 'r', 'theta');
fprintf(' %10.2f %10.2f %10.2f %10.2f\n',[x,y,r,t].');
fprintf('\n\n')