how do i adjust the alignment of the columns?
4 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
KSSV
2019-4-18
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'} )
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Distribution Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!