how do i adjust the alignment of the columns?
4 views (last 30 days)
Show older comments
Hey all
I am very new to Matlab. I have recently submitted my assignment to my lecturer, he graded it with comments. He said that i should not hardcode on the alignment. I won't be seeing my lecturer for a while, therefore i am unable to ask him. Could anyone please enlighten me on this? I am keen to learn more.
I would like the output to appear like this
SGD USD GBP EURO
1.00 0.74 0.56 0.66
2.00 1.48 1.12 1.32
3.00 2.22 1.68 1.98
Here is what i have submitted.
clc
clear
a = [1 0.74 0.56 0.66];
b = (1:25)';
c = b * a;
fprintf(' SGD \t USD \t GBP \t EURO\n')
fprintf(' %.2f \t %.2f \t %.2f \t %.2f\n', c')
0 Comments
Answers (1)
KSSV
on 18 Apr 2019
I would suggest this:
a = [1 0.74 0.56 0.66];
b = (1:25)';
c = b * a;
T = table(c(:,1),c(:,2),c(:,3),c(:,4),'VariableNames',{'SGD', 'USD', 'GBP', 'EURO'} )
See Also
Categories
Find more on Data Distribution Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!